question: public static < T > int upperBound ( 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 ) { len = half ; } else { from = middle ; from ++ ; len = len - half - 1 ; } } return from ; }
target:  This method is equivalent to C++ std:upper_bound function Returns an index pointing to the first element in the ordered collection which is greater than passed value