private int findIndex(StoreKey keyToFind, ByteBuffer mmap) throws StoreException {
      // binary search on the mapped file
      int low = 0;
      int high = numberOfEntries(mmap) - 1;
      logger.trace("IndexSegment {} binary search low : {} high : {}", indexFile.getAbsolutePath(), low, high);
      while (low <= high) {
        int mid = (int) (Math.ceil(high / 2.0 + low / 2.0));
        StoreKey found = getKeyAt(mmap, mid);
        logger.trace("IndexSegment {} binary search - key found on iteration {}", indexFile.getAbsolutePath(), found);
        int result = found.compareTo(keyToFind);
        if (result == 0) {
          return mid;
        } else if (result < 0) {
          low = mid + 1;
        } else {
          high = mid - 1;
        }
      }
      return -1;
    }
Gets values for all matches for {@code keyToFind} at and in the vicinity of {@code positiveMatchInd}.
@param mmap the serEntries to read values off of
@param keyToFind the needle {@link StoreKey}
@param positiveMatchInd the index of a confirmed positive match
@param totalEntries the total number of entries in the index
@param values the set to which the {@link IndexValue}s will be added
@return a pair consisting of the lowest index that matched the key and the highest
@throws StoreException if there are problems reading from the mmap
ambry-store/src/main/java/com/github/ambry/store/IndexSegment.java