private int binarySearch ( T record ) { int low = 0 ; int high = this . boundaries . length - 1 ; typeComparator . extractKeys ( record , keys , 0 ) ; while ( low <= high ) { final int mid = ( low + high ) >>> 1 ; final int result = compareKeys ( flatComparators , keys , this . boundaries [ mid ] ) ; if ( result > 0 ) { low = mid + 1 ; } else if ( result < 0 ) { high = mid - 1 ; } else { return mid ; } } // key not found, but the low index is the target // bucket, since the boundaries are the upper bound return low ; }
Search the range index of input record .