What is the problem in this question one test case fail?

public class App20_HelpRahulToSearch {

public static int binarySearch(int[] arr , int data) {
	int low=0;
	int high=arr.length-1;
	
	while(low<=high) {
		int mid = (low+high)/2;
		
		if(data>arr[mid]) {
			low=mid+1;
		}
		else if(data<arr[mid]){
			high=mid-1;
		}
		else {
			return mid;
		}
	}
	
	return -1;
}

public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();

	int[] arr = new int[N];

	for (int i = 0; i < arr.length; i++) {
		arr[i] = sc.nextInt();
	}
    int data = sc.nextInt();
	int index = binarySearch(arr,data);
	if (index < 0) {
		System.out.println(index);
	} else {
		System.out.println(index);
	}
}

}

Input:
5
3
4
5
1
2
2
Correct output:
4
Your output:
-1

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.