平方函數:Math.pow(a,b)
new一個數組:
int[] index=new int[3];//已知容量 int[] index={2,3,4};//已知數據
int[][] index2=new int[2][3];//二維數組
new一個arraylist
List<String> list=new ArrayList<>(); List<HashSet<String>> list1=new ArrayList<>();
int-字符串互轉
Integer.parseInt("2");
System.out.println(String.valueOf(2));
數組-list互轉
list轉爲數組:toarray方法
這樣使用纔是帶泛型的
排序,反轉,二分查找
Arrays和Collections工具類中的方法
字符串和字符數組轉換
char[] charArray=ass.toCharArray();
棧和隊列這兩種數據結構
棧:後進先出
隊列:先進先出
Queue<String> queue=new LinkedList<>(); queue.add("2"); queue.poll();
Stack<String> strings=new Stack<>();
strings.push("")
strings.pop();