code: private static int searchEntry(final List<OMMapBufferEntry> fileEntries, final long iBeginOffset, final int iSize) {
      if (fileEntries == null || fileEntries.size() == 0)
        return -1;
  
      int high = fileEntries.size() - 1;
      if (high < 0)
        // NOT FOUND
        return -1;
  
      int low = 0;
      int mid = -1;
  
      // BINARY SEARCH
      OMMapBufferEntry e;
  
      while (low <= high) {
        mid = (low + high) >>> 1;
        e = fileEntries.get(mid);
  
        if (iBeginOffset >= e.beginOffset && iBeginOffset + iSize <= e.beginOffset + e.size) {
          // FOUND: USE IT
          OProfiler.getInstance().updateCounter("OMMapManager.reusedPage", 1);
          e.counter++;
          return mid;
        }
  
        if (low == high) {
          if (iBeginOffset > e.beginOffset)
            // NEXT POSITION
            low++;
  
          // NOT FOUND
          return (low + 2) * -1;
        }
  
        if (iBeginOffset >= e.beginOffset)
          low = mid + 1;
        else
          high = mid;
      }
  
      // NOT FOUND
      return mid;
    }
docs: Search for a buffer in the ordered list.
  
  @param fileEntries
  to search necessary record.
  @param iBeginOffset
  file offset to start search from it.
  @param iSize
  that will be contained in founded entries.
  @return negative number means not found. The position to insert is the (return value +1)*-1. Zero or positive number is the
  found position.