public static <T>int lowerBound(final List<T> valueList,int fromIdx,int toIdx,final Comparable<T> value){
  int len=toIdx - fromIdx + (toIdx > fromIdx ? 1 : 0);
  int from=fromIdx;
  int half;
  int middle;
  while (len > 0) {
    half=len >> 1;
    middle=from;
    middle=middle + half;
    if (value.compareTo(valueList.get(middle)) == 1) {
      from=middle;
      from++;
      len=len - half - 1;
    }
 else {
      len=half;
    }
  }
  return from;
}

public static < T > int lowerBound ( final List < T > valueList , int fromIdx , int toIdx , final Comparable < T > value ) { int len = toIdx - fromIdx + ( toIdx > fromIdx ? 1 : 0 ) ; int from = fromIdx ; int half ; int middle ; while ( len > 0 ) { half = len > > 1 ; middle = from ; middle = middle + half ; if ( value . compareTo ( valueList . get ( middle ) ) == 1 ) { from = middle ; from ++ ; len = len - half - 1 ; } else { len = half ; } } return from ; }
this method is equivalent to std : lower_bound function returns an index pointing to the first element in the ordered collection is equal or greater than passed value
