code: private static int search(ArrayList<Entry> entries, int target, int start, int end) {
      while (true) {
        int mid = ((end - start) / 2) + start;
        int compare = compareEntry(entries, mid, target);
        if (compare == 0) {
          return mid;
        } else if (compare < 0) {
          // it is in the upper half
          start = mid + 1;
          if (start > end) {
            return end;
          }
        } else {
          // it is in the lower half
          end = mid - 1;
          if (end < start) {
            return end;
          }
        }
      }
    }
docs: Perform a binary search on the array to find a section that covers
  the target column.