public class ErFen {
public static void main(String[] args) {
int[] arr = { 1, 3, 6, 9, 12, 15, 17 };
int left = 0;
int s = 17;
int right = arr.length - 1;
for (int i = 0; i < arr.length; i++) {
int t = (left + right) / 2;
if (s == arr[t]) {
System.out.println(t);
break;
}
if (s > arr[t]) {
left = t + 1;
}
if (s < arr[t]) {
right = t - 1;
}
}
}
}