List of utility methods to do Integer From
int | intFrom(byte a, byte b, byte c, byte d) int From return (a << 24) + (b << 16) + (c << 8) + d;
|
int | intFrom2Bytes(byte[] bytes, int index) Get an unsigned integer from two bytes sampled from within a byte stream, starting at the specified index return ((bytes[index] << 8) + bytes[index + 1]);
|
long | intFrom4Bytes(byte[] bytes, int index) Get an unsigned integer from a 4-byte word return intFrom4Bytes(bytes, index, false);
|
int | intFromBase64(String value) int From Base return (int) longFromBase64(value); |
int | intFromBigEndainByteArray(byte[] buf, int offset, int len) utility to generate an int from an array of bytes in BigEndain order return (int) longFromBigEndainArray(buf, offset, len); |
int | intFromByte(byte byteValue) Get an unsigned integer from a single byte. int val = 0; val |= byteValue & 0x000000ff; return val; |
int | intFromByteArray(final byte[] buf, final int offset) int From Byte Array int v = 0; v |= ((((int) buf[offset + 0]) & 0xFF) << 24); v |= ((((int) buf[offset + 1]) & 0xFF) << 16); v |= ((((int) buf[offset + 2]) & 0xFF) << 8); v |= ((((int) buf[offset + 3]) & 0xFF) << 0); return v; |
int | intFromByteArray(final byte[] byteArray) int From Byte Array if (byteArray == null || byteArray.length == 0) { throw new IllegalArgumentException("Cannot convert an empty array into an int"); int result = (0xff & byteArray[0]); for (int i = 1; i < byteArray.length; i++) { result = (result << 8) | (0xff & byteArray[i]); return result; ... |
int[] | intFromByteRGB(byte[] reds, byte[] greens, byte[] blues) int From Byte RGB int[] pixels = new int[reds.length]; for (int i = 0; i < pixels.length; i++) { pixels[i] = ((reds[i] & 0xff) << 16) | ((greens[i] & 0xff) << 8) | (blues[i] & 0xff); return pixels; |
int | intFromBytes(byte[] b) int From Bytes return (b[0] << 24) | (b[1] & 0xFF) << 16 | (b[2] & 0xFF) << 8 | (b[3] & 0xFF);
|