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