public static void main(String[] args){
}
public final static int NOT_FOUND = -1;
public int binarySearch (int[] number, int searchValue){
int low = 0,
high = number.length - 1,
mid = (low + high) / 2;
while(low <= high && number[mid] != searchValue){
if(number[mid] < searchValue){
low = mid + 1;
} else {
high = mid -1;
}
mid = (low + high) / 2;
}
if(low > high){
mid = NOT_FOUND;
}
return mid;
}
}
I made a binary search but it didn't run. what is the problem in the codes? There is no error but when I run it theres nothing.