public static void main(String[] args) {
int[] nums = { 10, 2, 32, 9 };
int[] nums2 = { 10, 2, 9, 32 };
// 比较 两个数组是否相等 (数组的内容,个数,顺序)
boolean eq = Arrays.equals(nums, nums2);
System.out.println(eq);
}
public static void main(String[] args) {
int[] nums = { 10, 2, 32, 9 };
// 填充
Arrays.fill(nums, 19);
System.out.println(Arrays.toString(nums));
}
// [19, 19, 19, 19]
public static void main(String[] args) {
int[] nums = { 10, 2, 32, 9 };
// 排序
Arrays.sort(nums);
System.out.println(Arrays.toString(nums));
}
// [2, 9, 10, 32]
public static void main(String[] args) {
int[] nums = { 10, 2, 32, 9 };
// 排序
Arrays.sort(nums);
System.out.println(Arrays.toString(nums));
//二分法查找 ,一定先排序,如果找不到返回負數
int index = Arrays.binarySearch(nums,10);
System.out.println(index);
}