@@ -0,0 +1,1030 @@
+import java.util.Scanner;%0A%0Aclass BinarySearch %7B%0A%09%0A%09//Function using binary search algo in recursive method%0A%09int binarysearch(int%5B%5D arr,int l,int r,int x)%0A%09%7B%0A%09%09if(r%3E=l)%0A%09%09%7B%0A%09%09%09int mid=l+(r-l)/2;%0A%09%09%09%0A%09%09%09if(arr%5Bmid%5D==x)%0A%09%09%09%09return mid;%0A%09%09%09%0A%09%09%09if(arr%5Bmid%5D%3Ex)%0A%09%09%09%09return binarysearch(arr,l,mid-1,x);%0A%09%09%09%0A%09%09%09%09return binarysearch(arr,mid+1,r,x);%0A%09%09%7D%0A%09%09return -1;%0A%09%7D%0A%09%0A%09//Main function is used to take inputs%0A%09public static void main(String args%5B%5D)%0A%09%7B%0A%09%09Scanner input=new Scanner(System.in);%0A%09%09BinarySearch obj=new BinarySearch();%0A%09%09%0A%09%09System.out.print(%22Enter number of elements in array:%22);%0A%09%09int n=input.nextInt();%0A%09%09%0A%09%09int%5B%5D arr=new int%5Bn%5D;%0A%09%09System.out.println(%22Enter elements of the array:%22);%0A%09%09for(int i=0;i%3Cn;i++)%0A%09%09arr%5Bi%5D=input.nextInt();%0A%09%09%0A%09%09System.out.print(%22Enter element to be searched:%22);%0A%09%09int el=input.nextInt();%0A%09%09%0A%09%09int result = obj.binarysearch(arr,0,n-1,el);%0A%09%09%0A%09    if (result == -1)%0A%09        System.out.println(%22Element not present%22);%0A%09    else%0A%09        System.out.println(%22Element found at index %22+result);%0A%09%09%0A%09%7D%0A%7D%0A

Create BinarySearch.java