Given
private int width = 400; private byte [] data = new byte [2];
I want to split the integer \"width\" into two bytes and load data[0]
To get the high byte, shift right by 8 bits then mask off the top bytes. Similarly, to get the low byte just mask off the top bytes.
data[0] = (width >> 8) & 0xff; data[1] = width & 0xff;