Nibble transposed when storing binary files

69 views Asked by At

I have some code that populates some binary data into a ByteBuffer, and then writes it to the disk using a FileChannel. Everything works great, and when I use hexdump on the file, I expect to see bytes stored in little-endian byte order (because my system uses the x86_64 instruction set). But instead, I see that the nibbles are transposed. What am I missing? Is this a quirk of the hexdump utility?

Integer in code: 0x01020304 (declared as private int myNumber = 0x01020304;)

Expected order in storage: 0x04 x03 x02 x01

Actual order in storage: 0x30 x40 x10 x20

0

There are 0 answers