I am trying to convert an int
into three bytes
representing that int
(big endian).
I'm sure it has something to do with bit-wise and and bit shifting. But I have no idea how to go about doing it.
For example:
int myInt;
// some code
byte b1, b2 , b3; // b1 is most significant, then b2 then b3.
*Note, I am aware that an int is 4 bytes and the three bytes have a chance of over/underflowing.