private static boolean contains(int start, int end, int seq) {
        if (start <= end) {
            return seq >= start && seq <= end;
        } else {
            // wrap around
            return seq >= start || seq <= end;
        }
    }
Check if the sequence number is in the range [start, end] (inclusive).
The range may wrap around the sequence space.
storage/src/main/java/org/apache/kafka/storage/internals/log/ProducerStateEntry.java