what is error in my code–
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
int n = cin.nextInt(), arr[] = new int[n];
for(int i = 0;i<arr.length;i++){
arr[i] = cin.nextInt();
}
int m = cin.nextInt();
int res = binarySearch(arr,0,arr.length-1,m);
System.out.println(res);
}
public static int binarySearch(int []arr,int l,int r,int key){
if(l>r){
// System.out.println(“Element not found”);
return -1;
}
int mid = l+r/2;
while(l<=r){
if(arr[mid]>key){
r = mid-1;
}else if(arr[mid] == key){
return mid;
}else{
l = mid+1;
}
binarySearch(arr,l,r,key);
}
return -1;
}
}