public class Work {
public static void main(String[] args){
System.out.println("排序后的数组为:");
Sorting S=new Sorting();
S.work();
System.out.println("查找数组中的元素");
Search S1=new Search();
S1.search(S.xArray);
}
}
public class Sorting {
int xArray[]={12,45,67,89,123,-45,67};
int L=xArray.length;
int M=0;
public void work(){
for(int j=0;j
xArray[middle])
end=middle;
middle=(start+end)/2;
count++;
if(count>L/2)
break;
}
if(count>L/2)
System.out.println(number+" 不在数组中");
else
System.out.println(number+" 在数组中");
}
}
