private int getBundleReadEndIndex(List<IndexEntry> sortedSrcIndexEntries, int start) {
    long startOffset = sortedSrcIndexEntries.get(start).getValue().getOffset().getOffset();
    int end;
    for (end = start; end < sortedSrcIndexEntries.size(); end++) {
      long currentSize =
          sortedSrcIndexEntries.get(end).getValue().getOffset().getOffset() + sortedSrcIndexEntries.get(end)
              .getValue()
              .getSize() - startOffset;
      if (currentSize > bundleReadBuffer.length) {
        break;
      }
    }
    return end - 1;
  }
Calculate the farthest index that can be used for a bundle IO read based on start index and bundleReadBuffer capacity.
@param sortedSrcIndexEntries all available entries, which are ordered by offset.
@param start the starting index for the given list.
@return the farthest index, inclusively, which can be used for a bundle read.
ambry-store/src/main/java/com/github/ambry/store/BlobStoreCompactor.java