{
public static void main(String[] args)
{
int[] a={3,6,9,11,13,15,20};
int i=HalfSearch(a,15);
System.out.println("查找结果");
System.out.println("index="+i);
}
public static int HalfSearch(int[] arr,int num)
{
int max,min,mid;
max=arr.length-1;
min=0;
mid=(max+min)<<1;
while(arr[mid]!=num)
{
if(num>arr[mid])
min=mid+1;
else if(num
if(min>max)
return -1;
mid=(max+min)<<1;
}
return mid;
}
}