public OffsetPosition lookup(long targetOffset) {
        return maybeLock(lock, () -> {
            ByteBuffer idx = mmap().duplicate();
            int slot = largestLowerBoundSlotFor(idx, targetOffset, IndexSearchType.KEY);
            if (slot == -1)
                return new OffsetPosition(baseOffset(), 0);
            else
                return parseEntry(idx, slot);
        });
    }
Find the largest offset less than or equal to the given targetOffset
and return a pair holding this offset and its corresponding physical file position.

@param targetOffset The offset to look up.
@return The offset found and the corresponding file position for this offset
        If the target offset is smaller than the least entry in the index (or the index is empty),
        the pair (baseOffset, 0) is returned.
storage/src/main/java/org/apache/kafka/storage/internals/log/OffsetIndex.java