863750 wrote:The trouble is that comparing with C/C++ is not a good fit here. Java primitive numbers have a consistent byte ordering and 'endianism' (ugh), C++'s don't; it will depend on how the machine does it.
I should say I have two questions. One is how to convert from double or long to a byte array, and the other is how to convert a byte array to double or long.
Right now I'm more interested in converting double or long to a byte array.
863750 wrote:So you have a java program that does nothing but serialize doubles?
These operations requires some ALU instructions. They might be nothing for powerful servers, but for Atom processors, it's still quite heavy when working on several hundred GB data.
I suggest you try using ByteBuffer as you can use ByteOrder.native() ...There is no such method.
to have direct access. However, if the byte order you are using doesn't match, the bytes will have to be re-ordered.... which ByteBuffer can already do.