List of utility methods to do Short Number Create
short | toShort(byte a, byte b) to Short return (short) (((a & 0x00ff) << 8) + (b & 0x00ff)); |
short | toShort(byte b0, byte b1) Returns a short built from two bytes. return (short) (b0 & 0xFF | b1 << 8); |
short | toShort(byte byte0, byte byte1) Constructs short given two bytes. int hiByte = byte1 << 8; int loByte = (byte0 << 24) >>> 24; return (short) (hiByte | loByte); |
short | toShort(byte mostSignificant, byte leastSignificant) Converts a pair of bytes to a short short n = 0; n ^= mostSignificant & 0xFF; n <<= 8; n ^= leastSignificant & 0xFF; return n; |
short | toShort(byte msb, byte lsb) Convert 2 bytes into a short. return (short) ((0xff00 & (short) (msb << 8)) | (0x00ff & (short) lsb)); |
short | toShort(byte... b) to Short return (short) toLong(b); |
short | toShort(byte... b) to Short return (short) toLong(b); |
short | toShort(byte[] b) to Short return toShort(b, 0);
|
short | toShort(byte[] b) Converts the first two bytes of b to a 16-bit signed integer. return toShort(b, 0);
|
short | toShort(byte[] b) to Short short s = 0; short s0 = (short) (b[0] & 0xff); short s1 = (short) (b[1] & 0xff); s1 <<= 8; s = (short) (s0 | s1); return s; |