since Java doesn't provide a default way to do this,
what's a fast way to convert an Integer into a Byte Array?
e.g. 0xAABBCCDD => {AA, BB, CC, DD}
feedback
|
Have a look at the ByteBuffer class.
Setting the byte order ensures that Or alternatively, you could do it manually:
The
| |||||||||||||||||
feedback
|
use this function it works for me
it translates the int into a byte value | ||||
feedback
|
You can use From Integers:
The returned array is of the size that is needed to represent the number, so it could be of size 1, to represent 1 for example. However, the size cannot be more than four bytes if an int is passed. From Strings:
However, you will need to watch out, if the first byte is higher | |||||||
feedback
|
Using
Using
Using
| |||||
feedback
|