Arrays
public class ArraysDemo {
public static void main(String[] args) {
int temp[] = {3, 5, 7, 9, 1, 2, 6, 8};
Arrays.sort(temp);
System.out.println("排序后的数组 : ");
System.out.println(Arrays.toString(temp));
int point = Arrays.binarySearch(temp, 3);
System.out.println(point);
Arrays.fill(temp, 3);
System.out.println("数组填充 : ");
System.out.println(Arrays.toString(temp));
}
}
Output
排序后的数组 :
[1, 2, 3, 5, 6, 7, 8, 9]
2
数组填充 :
[3, 3, 3, 3, 3, 3, 3, 3]