code: public long getCompactableIndex(long index) {
      Map.Entry<Long, JournalSegment<E>> segmentEntry = segments.floorEntry(index);
      return segmentEntry != null ? segmentEntry.getValue().index() : 0;
    }
docs: Returns the index of the last segment in the log.
  
  @param index the compaction index
  @return the starting index of the last segment in the log