It's easier to use a ByteBuffer to do this kind of operation