package Day03_test01;/*
@create 2020--11--19--20:38
*/
import java.util.Arrays;
public class Demo11_Search {
public static void main(String[] args) {
int[] arr = new int[10];
for (int i = 0; i < arr.length; i++) {
arr[i] = 1+i; //给数组赋值
}
Arrays.sort(arr);
for (int i:arr){
System.out.print(i+" ");
}
int index = Arrays.binarySearch(arr,7); //二分查找法,查找数字7的位置
System.out.println(index);
}
}