public class Demo1 {
public static void main(String[] args) {
int[] arr ={12,23,25,33,36,45,67};
String str = Arrays.toString(arr);
System.out.println(str);
//public static void sort(int[] a):对数组进行排序
int[] arr1 = {21,34,28,36,46,13,59};
Arrays.sort(arr1);
System.out.println(Arrays.toString(arr1));
//public static int binarySearch(int[] a,int key):对数组进行二分查找。
int[] arr2 = {13, 21, 28, 34, 36, 46, 59};
System.out.println(Arrays.binarySearch(arr2,28));
}
}
|
|