// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class RecBinFin {
   public static boolean recbinfnd(int[] a, int l, int r, int v) {
      if(l > r) {
         return false;
      } else {
         int mid = (l + r) / 2;
         if(a[mid] == v) {
            return true;
         } else if(a[mid] > v) {
            return recbinfnd(a, l, mid - 1, v);
         } else {
            return recbinfnd(a, mid + 1, r, v);
         }
      }
   }
   public static boolean recbinfnd(int[] a, int v) {
      return recbinfnd(a, 0, a.length - 1, v);
   }
   public static void main(String[] args) {
      int[] a = { 1, 3, 5, 7, 9, 11, 13 };
      for(int i = 0; i < 15; i++) {
         System.out.println(i + " " + recbinfnd(a, i));
      }
   }
}
