import java.util.Scanner;
public class zuizhong {
public static void main(String[] args) {
Scanner imput = new Scanner(System.in);
System.out.println("请输入查找的数");
int n = imput.nextInt();
/*定义一个100的数组。遍历赋值
*/
int score[] = new int[100];
for (int i = 0; i <= score.length - 1; i++) {
score[i] = i;
}
int high = score.length - 1;
int low = 0;
zuizhong gg = new zuizhong();
gg.found(score, high, low, n);
}
public int found(int score[], int high, int low, int n) {
int mit = (high + low) / 2;
if (low > high) {
return -1;
}
if (n < score[mit]) {
return found(score, mit - 1, low, n);
} else if (n > score[mit]) {
return found(score, high, mit + 1, n);
} else if (n == score[mit]) {
System.out.println(n + "在数组中的位置是" + mit);
return (mit);
}
return -1;
}
}