public OptionalLong largestRecordTimestamp() throws IOException {
        long maxTimestampSoFar = maxTimestampSoFar();
        if (maxTimestampSoFar >= 0)
            return OptionalLong.of(maxTimestampSoFar);
        return OptionalLong.empty();
    }
The largest timestamp this segment contains, if maxTimestampSoFar >= 0, otherwise Empty.
storage/src/main/java/org/apache/kafka/storage/internals/log/LogSegment.java