Skip to content Skip to sidebar Skip to footer

Get Int From Bytes In Java, Encoded First In C#

I am having a problem converting an int from a byte array first encoded in C#. I first convert it into big-endian because Java works in big-edian rather than small. The following c

Solution 1:

A ByteBuffer can be configured to decode multi-byte values as either big or little endian using the order() method.

For example:

finalByteBufferbb= ByteBuffer.wrap(buffer);
bb.order(ByteOrder.LITTLE_ENDIAN);

finalinti= bb.getInt();
...

Solution 2:

Post a Comment for "Get Int From Bytes In Java, Encoded First In C#"