Possible duplicate:
Convert integer to byte array (Java)
I need to save the length of the buffer, in a byte array - 4 bytes.
Pseudocode:
private byte[] convertLengthToByte(byte[] myBuffer) { int length = myBuffer.length; byte[] byteLength = new byte[4];
What would be the best way to do this? Remembering that I have to convert this byte array back to an integer later.
java byte buffer
Petey B Jun 16 '11 at 16:01 2011-06-16 16:01
source share