0.Design Pointsยง

Byte manipulation

lenb = new byte[2];
lenbb = ByteBuffer.wrap(lenb);
int len = 25;
lenbb.putShort(0, (short)len);     // Put into byte buffer
int msgLength = lenbb.getShort(0); // Take it back out