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