title: Can't able to find the bug - Binary Search using Recursion
body: <pre><code>/*for the elements which are present in the code, the code runs succesfully but for the elements which
    are not in the array list showing error in code statement no. 33*/
  
  package recursion;
  
  public class BinarySearch {
  
      public static void main(String args[])
      {
          int array[]={1,2,5,6,7,32,38,48,75,87,98};// 11 elements
          int find=3;
          boolean ans=binarySearch(find, array, 0, array.length-1);
          if(ans==true)
              System.out.println("Number Available");
          else
              System.out.println("Number not Available");
      }
  
      static boolean binarySearch(int valToFind, int arr[], int start, int end)
      {
          boolean avail=false;
          if(start == end)
          {
              if(arr[start]==valToFind)
                  avail=true;
              else
                  avail=false;        
          }
  
          int mid;
          mid=findmid(arr,start,end);
  
          if(arr[mid]&gt;valToFind)
              binarySearch(valToFind,arr,start,mid-1);
          else if(arr[mid]&lt;valToFind)
              binarySearch(valToFind,arr,mid+1,end);
          else if(arr[mid]==valToFind)
              avail= true;
  
          return avail;
      }
  
      static int findmid(int arr[],int start, int end)
      {
          int mid = (start+end)/2;
          return mid;
      }
  }
  </code></pre>