Lower bound implementation
static int lowerBound ( Vector < Integer > array , int value ) { int low = 0 ; int high = array . size ( ) ; while ( low < high ) { final int mid = ( low + high ) / 2 ; if ( value <= array . elementAt ( mid ) ) { high = mid ; } else { low = mid + 1 ; } } return low ; }