List of utility methods to do Short Number Create
short | toShort(byte[] b) to Short short value = 0; for (int x = 0; x < b.length; x++) { value |= b[x] & 0xFF; if (x != b.length - 1) { value <<= 8; return value; ... |
short | toShort(byte[] b) Converts a byte array of 1-2 bytes to a short. if ((b.length < 1) || (b.length > 2)) { throw new IllegalArgumentException("Array of size " + b.length + " cannot be converted to short."); short result = 0; for (int i = 0; i < b.length; i++) { result = (short) (((0xFF & b[i]) << ((b.length - i - 1) * 8)) | result); return result; ... |
short | toShort(byte[] b, int off, boolean bigEndian) to Short if (bigEndian) { return (short) (((b[0] & 0xff) << 8) | (b[1] & 0xff)); } else { return (short) (((b[1] & 0xff) << 8) | (b[0] & 0xff)); |
short | toShort(byte[] b, int offset) to Short return (short) (((b[offset] & 0x000000FF) << 8) + ((b[offset + 1] & 0x000000FF))); |
short | toShort(byte[] buf, int pos) to Short return (short) (toUnsignedByte(buf, pos) << 8 + toUnsignedByte(buf, pos + 1)); |
short | toShort(byte[] byteArray) to Short if (byteArray == null || byteArray.length != 2) return 0x0; return (short) ((0xff & byteArray[0]) << 8 | (0xff & byteArray[1]) << 0); |
short | toShort(byte[] bytes) This method one little-endian represented byte array converts to short. return (short) (bytes[0] & OP_PATTERN | (bytes[1] & OP_PATTERN) << 8); |
short | toShort(byte[] bytes) Converts a byte array to a short value return toShort(bytes, 0);
|
short | toShort(byte[] bytes) Convert a byte array to a short integer. return toShort(bytes, true);
|
short | toShort(byte[] bytes) Converts a byte array to a short value return toShort(bytes, 0, SIZEOF_SHORT);
|