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
ret[0] = (byte)(x & 0xff); ret[1] = (byte)((x >> 8) & 0xff);