public static int incrementSequence(int sequence, int increment) {
        if (sequence > Integer.MAX_VALUE - increment)
            return increment - (Integer.MAX_VALUE - sequence) - 1;
        return sequence + increment;
    }
@Test
    public void testIncrementSequence() {
        assertEquals(10, DefaultRecordBatch.incrementSequence(5, 5));
        assertEquals(0, DefaultRecordBatch.incrementSequence(Integer.MAX_VALUE, 1));
        assertEquals(4, DefaultRecordBatch.incrementSequence(Integer.MAX_VALUE - 5, 10));
    }