public static int readUint16(ByteBuffer buf) throws BufferUnderflowException {
        return Short.toUnsignedInt(buf.order(ByteOrder.LITTLE_ENDIAN).getShort());
    }
@Test
    public void testReadUint16() {
        assertEquals(258L, ByteUtils.readUint16(new byte[]{2, 1}, 0));
        assertEquals(258L, ByteUtils.readUint16(new byte[]{2, 1, 3, 4}, 0));
        assertEquals(772L, ByteUtils.readUint16(new byte[]{1, 2, 4, 3}, 2));
    }