Hey,
Iv been looking around for a simple way (meaning less than 10 lines) to reverse the order of my bytes in a byte array. At the moment my code is:
public byte[] outputarray()
{
byte b[] = new byte[10];
ByteBuffer buf = ByteBuffer.wrap(b);
buf.putLong(output);
}
The problem is that the array is on the wrong order. So when i save the byte array to the file its contents in binary are in reverse. So anyone know the easiest way or possibly an api way to easily reverse the bytes, i tried flip but it doesent seem to be what im looking for.
The oracle website claims to have a reverse function in ByteBuffer but it does not show up in eclipse:
http://download.oracle.com/otn_hosted_doc/jdeveloper/1012/jdev-doc/oracle/ide/util/ByteBuffer.html
Any help would be nice :)