import java.util.Scanner;
public class Test {
public static void main(String[] args) {
int start = 0,end,middle;
int a[]={1,23,4,42,54,67,92,46};
for (int i = 0; i a[j]){
int t=a[j];
a[j]=a[i];
a[i]=t;
}
}
}
Scanner sc = new Scanner(System.in);
System.out.println("输入整数,判断是否在数组中");
int number = sc.nextInt();
int count=0;
end=a.length;
middle=(start+end)/2;
while(number!=a[middle]){
if(number>a[middle]){ //如果输入的数字大于中位数,则初始为中位
start = middle;
}else if(numbera.length/2){ //超过中位则说明数字不在数组中
break;
}
}
if(count>a.length/2){
System.out.println(number+"不在数组中");
}else{
System.out.println(number+"在数组中");
}
}
}