public static int decrementSequence(int sequence, int decrement) {
        if (sequence < decrement)
            return Integer.MAX_VALUE - (decrement - sequence) + 1;
        return sequence - decrement;
    }
@Test
    public void testDecrementSequence() {
        assertEquals(0, DefaultRecordBatch.decrementSequence(5, 5));
        assertEquals(Integer.MAX_VALUE, DefaultRecordBatch.decrementSequence(0, 1));
    }