@SuppressWarnings("unchecked") private static int find(Object[] arr,java.lang.Comparable val,int bnd,int l,int r){
  int m=l;
  int d=1;
  while (m <= r) {
    if (val.compareTo(arr[m]) > bnd) {
      l=m + 1;
    }
 else {
      r=m - 1;
      break;
    }
    m+=d;
    d<<=1;
  }
  while (l <= r) {
    m=(l + r) >>> 1;
    if (val.compareTo(arr[m]) > bnd) {
      l=m + 1;
    }
 else {
      r=m - 1;
    }
  }
  return l - 1;
}

@ SuppressWarnings ( "unchecked" ) private static int find ( Object [ ] arr , java . lang . Comparable val , int bnd , int l , int r ) { int m = l ; int d = 1 ; while ( m <= r ) { if ( val . compareTo ( arr [ m ] ) > bnd ) { l = m + 1 ; } else { r = m - 1 ; break ; } m += d ; d <<= 1 ; } while ( l <= r ) { m = ( l + r ) > > > 1 ; if ( val . compareTo ( arr [ m ] ) > bnd ) { l = m + 1 ; } else { r = m - 1 ; } } return l - 1 ; }
finds the place in the given range of specified sorted array , where the element should be inserted for getting sorted array . uses exponential search algorithm .
