public static void incrementInt(final ByteBuffer byteBuffer,
                                    final int idx) {
        final int val = byteBuffer.getInt(idx);
        if (val == Integer.MAX_VALUE) {
            throw new ArithmeticException("Can't increment beyond max value of " + Integer.MAX_VALUE);
        }
        byteBuffer.putInt(idx, val + 1);
    }
Increments a Integer value at absolute position idx. Does not modify the position
of the buffer.
stroom-bytebuffer/src/main/java/stroom/bytebuffer/ByteBufferUtils.java