what is wrong with this code of binary search however it is same code for binary search which i learned in java crux online course.Please help it prints every time -1
public class Binary {
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] arr2= {2,8,454,5,89,465,464,15,546,79};
int items=5;
System.out.println(binarySearch(arr2, items));
}
public static int binarySearch(int[] arr, int item) {
int lo = 0;
int hi = arr.length - 1;
while (lo <= hi) {
int mid = (lo + hi) / 2;
if (arr[mid] < item) {
lo = mid + 1;
} else if (arr[mid] > item) {
hi = mid - 1;
} else {
return mid;
}
}
return -1;
}
}