Code is giving correct answer but all test cases are getting failed, please guide me

import java.util.*;
public class Main {
public static void main(String args[]) {
int[] arra = takeInput();
System.out.println(Binary_Search(arra, 0, arra.length-1, 6));
}

public static int Binary_Search(int[] arr, int lo, int hi, int ele) {
int mid = (lo + hi) / 2;
if(lo>hi) {
return -1;
}
while (lo <= hi) {
if (ele < arr[mid]) {
hi = mid-1;
} else if (ele == arr[mid]) {
// System.out.println(mid);
break;

		} else {
			lo = mid+1;
		}
		mid = (lo + hi) / 2;
	}
	return mid;
	
}

public static int[] takeInput() {
	Scanner scn = new Scanner(System.in);
	int n = scn.nextInt();
	int[] arr = new int[n];
	for(int i=0; i<n; i++) {
		arr[i] = scn.nextInt();
	}
	return arr;
}

}

@vashisthdeepak928
you have to take another input m which is the element you need to search in the array.
You are always searching element 6

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.