Program: 161766
Project: 161766
Buggy source:
/** 
 * A faster binary search algorithm for sorting a list. This algorithm works by actually knowing the values  and making smart decisions about how far to jump in  the list based on those values.  Which is why this can not take in a comparable interface like Collections does.  This was adapted from code posted from this  blog post: http://ochafik.com/blog/?p=106
 * @param list to be searched through
 * @param key delay value to search for
 * @param randomAccessList true to optimize for list that have cheap random access
 * @return index where found, or -(insertion point) - 1 if not found
 */
public static int binarySearch(List<? extends Delayed> list,Delayed key,boolean randomAccessList){
  if (list.isEmpty()) {
    return -1;
  }
  final int absoluteMin=0;
  final int absoluteMax=list.size() - 1;
  long keyValue=key.getDelay(TimeUnit.MILLISECONDS);
  int min=absoluteMin;
  int max=absoluteMax;
  long minVal=list.get(absoluteMin).getDelay(TimeUnit.MILLISECONDS);
  long maxVal=list.get(absoluteMax).getDelay(TimeUnit.MILLISECONDS);
  int nPreviousSteps=1;
  while (true) {
    if (keyValue <= minVal) {
      return keyValue == minVal ? min : -1 - min;
    }
 else     if (keyValue >= maxVal) {
      return keyValue == maxVal ? max : -2 - max;
    }
    int pivot;
    if (nPreviousSteps > MAX_STEPS_TILL_B_SEARCH_SWITCH) {
      pivot=(min + max) >> 1;
    }
 else {
      pivot=min + (int)((keyValue - (float)minVal) / (maxVal - (float)minVal) * (max - min));
      nPreviousSteps++;
    }
    long pivotVal=list.get(pivot).getDelay(TimeUnit.MILLISECONDS);
    if (keyValue > pivotVal) {
      min=pivot + 1;
      if (min > absoluteMax) {
        return absoluteMax + 1;
      }
      minVal=list.get(min).getDelay(TimeUnit.MILLISECONDS);
      if (randomAccessList) {
        max--;
        maxVal=list.get(max).getDelay(TimeUnit.MILLISECONDS);
      }
    }
 else     if (keyValue < pivotVal) {
      max=pivot - 1;
      if (max < absoluteMin) {
        return absoluteMin;
      }
      maxVal=list.get(max).getDelay(TimeUnit.MILLISECONDS);
      if (randomAccessList) {
        min++;
        minVal=list.get(min).getDelay(TimeUnit.MILLISECONDS);
      }
    }
 else {
      return pivot;
    }
  }
}

Fixed version (ground truth):
/** 
 * A faster binary search algorithm for sorting a list. This algorithm works by actually knowing the values  and making smart decisions about how far to jump in  the list based on those values.  Which is why this can not take in a comparable interface like Collections does.  This was adapted from code posted from this  blog post: http://ochafik.com/blog/?p=106
 * @param list to be searched through
 * @param insertionValueInMillis delay time in milliseconds to search for insertion point
 * @param randomAccessList true to optimize for list that have cheap random access
 * @return index where found, or -(insertion point) - 1 if not found
 */
public static int binarySearch(List<? extends Delayed> list,long insertionValueInMillis,boolean randomAccessList){
  if (list.isEmpty()) {
    return -1;
  }
  final int absoluteMin=0;
  final int absoluteMax=list.size() - 1;
  int min=absoluteMin;
  int max=absoluteMax;
  long minVal=list.get(absoluteMin).getDelay(TimeUnit.MILLISECONDS);
  long maxVal=list.get(absoluteMax).getDelay(TimeUnit.MILLISECONDS);
  int nPreviousSteps=1;
  while (true) {
    if (insertionValueInMillis <= minVal) {
      return insertionValueInMillis == minVal ? min : -1 - min;
    }
 else     if (insertionValueInMillis >= maxVal) {
      return insertionValueInMillis == maxVal ? max : -2 - max;
    }
    int pivot;
    if (nPreviousSteps > MAX_STEPS_TILL_B_SEARCH_SWITCH) {
      pivot=(min + max) >> 1;
    }
 else {
      pivot=min + (int)((insertionValueInMillis - (float)minVal) / (maxVal - (float)minVal) * (max - min));
      nPreviousSteps++;
    }
    long pivotVal=list.get(pivot).getDelay(TimeUnit.MILLISECONDS);
    if (insertionValueInMillis > pivotVal) {
      min=pivot + 1;
      if (min > absoluteMax) {
        return absoluteMax + 1;
      }
      minVal=list.get(min).getDelay(TimeUnit.MILLISECONDS);
      if (randomAccessList) {
        max--;
        maxVal=list.get(max).getDelay(TimeUnit.MILLISECONDS);
      }
    }
 else     if (insertionValueInMillis < pivotVal) {
      max=pivot - 1;
      if (max < absoluteMin) {
        return absoluteMin;
      }
      maxVal=list.get(max).getDelay(TimeUnit.MILLISECONDS);
      if (randomAccessList) {
        min++;
        minVal=list.get(min).getDelay(TimeUnit.MILLISECONDS);
      }
    }
 else {
      return pivot;
    }
  }
}