How can I convert a short (2 bytes) to a byte array in Java, e.g.
short
short x = 233; byte[] ret = new byte[2]; ...
it should be s
Figured it out, its:
public static byte[] toBytes(short s) { return new byte[]{(byte)(s & 0x00FF),(byte)((s & 0xFF00)>>8)}; }