T
toffe
Hi all,
I need an efficient way of turning an int into a byte array.
Examples:
int byte array
1) 0 -> {0}
2) 1 -> {1}
3) 256 -> {1,0}
4) 70000 -> {1,17,112} (since 70000 = 1 * 256^2 + 17 * 256 + 112)
I can think of a few more or less odd ways to do this,
but I need an efficient one. I suspect that there is some function
already built in into Java that does this very thing.
Any help on this one?
Cheers,
toffe
I need an efficient way of turning an int into a byte array.
Examples:
int byte array
1) 0 -> {0}
2) 1 -> {1}
3) 256 -> {1,0}
4) 70000 -> {1,17,112} (since 70000 = 1 * 256^2 + 17 * 256 + 112)
I can think of a few more or less odd ways to do this,
but I need an efficient one. I suspect that there is some function
already built in into Java that does this very thing.
Any help on this one?
Cheers,
toffe