public static int binarySearch(float[] array,int startIndex,int endIndex,float value){
  checkIndexForBinarySearch(array.length,startIndex,endIndex);
  int intBits=Float.floatToIntBits(value);
  int low=startIndex, mid=-1, high=endIndex - 1;
  while (low <= high) {
    mid=(low + high) >>> 1;
    if (lessThan(array[mid],value)) {
      low=mid + 1;
    }
 else     if (intBits == Float.floatToIntBits(array[mid])) {
      return mid;
    }
 else {
      high=mid - 1;
    }
  }
  if (mid < 0) {
    int insertPoint=endIndex;
    for (int index=startIndex; index < endIndex; index++) {
      if (value < array[index]) {
        insertPoint=index;
      }
    }
    return -insertPoint - 1;
  }
  return -mid - (lessThan(value,array[mid]) ? 1 : 2);
}

public static int binarySearch ( float [ ] array , int startIndex , int endIndex , float value ) { checkIndexForBinarySearch ( array . length , startIndex , endIndex ) ; int intBits = Float . floatToIntBits ( value ) ; int low = startIndex , mid = - 1 , high = endIndex - 1 ; while ( low <= high ) { mid = ( low + high ) > > > 1 ; if ( lessThan ( array [ mid ] , value ) ) { low = mid + 1 ; } else if ( intBits == Float . floatToIntBits ( array [ mid ] ) ) { return mid ; } else { high = mid - 1 ; } } if ( mid < 0 ) { int insertPoint = endIndex ; for ( int index = startIndex ; index < endIndex ; index ++ ) { if ( value < array [ index ] ) { insertPoint = index ; } } return - insertPoint - 1 ; } return - mid - ( lessThan ( value , array [ mid ] ) ? 1 : 2 ) ; }
performs a binary search for the specified element in a part of the specified sorted array .
