Java Utililty Methods Integer From

List of utility methods to do Integer From

Description

The list of methods to do Integer From are organized into topic(s).

Method

intintFrom(byte a, byte b, byte c, byte d)
int From
return (a << 24) + (b << 16) + (c << 8) + d;
intintFrom2Bytes(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]);
longintFrom4Bytes(byte[] bytes, int index)
Get an unsigned integer from a 4-byte word
return intFrom4Bytes(bytes, index, false);
intintFromBase64(String value)
int From Base
return (int) longFromBase64(value);
intintFromBigEndainByteArray(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);
intintFromByte(byte byteValue)
Get an unsigned integer from a single byte.
int val = 0;
val |= byteValue & 0x000000ff;
return val;
intintFromByteArray(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;
intintFromByteArray(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;
intintFromBytes(byte[] b)
int From Bytes
return (b[0] << 24) | (b[1] & 0xFF) << 16 | (b[2] & 0xFF) << 8 | (b[3] & 0xFF);