Android Utililty Methods Byte Array to Int Convert

List of utility methods to do Byte Array to Int Convert

Description

The list of methods to do Byte Array to Int Convert are organized into topic(s).

Method

intgetInt(byte[] bytes)
get Int
return (0xff & bytes[0]) | (0xff00 & (bytes[1] << 8))
        | (0xff0000 & (bytes[2] << 16))
        | (0xff000000 & (bytes[3] << 24));
intgetInt(int offset, byte[] fromBytes)
get Int
final int toInt;
toInt = ((0xff & fromBytes[offset + 0]) << 24)
        | ((0xff & fromBytes[offset + 1]) << 16)
        | ((0xff & fromBytes[offset + 2]) << 8)
        | ((0xff & fromBytes[offset + 3]) << 0);
return toInt;
intgetInt2(byte[] b, int offset)
get Int
return ((b[offset] & 0xff) << 8) | (b[offset + 1] & 0xff);
intgetInt3(byte[] b, int offset)
get Int
return ((b[offset] & 0xff) << 16) | ((b[offset + 1] & 0xff) << 8)
        | (b[offset + 2] & 0xff);
intgetIntFrom2ByteArray(final byte[] input)
get Int From Byte Array
final byte[] result = new byte[4];
result[0] = 0;
result[1] = 0;
result[2] = input[0];
result[3] = input[1];
return getIntFromByteArray(result);
intgetIntFromByte(final byte bite)
get Int From Byte
return Integer.valueOf(bite & 0xFF);
intgetIntFromByte(final byte bite)
Converts a byte to an int, preserving the sign.
return Integer.valueOf(bite & 0xFF);
intgetIntFromByteArray(final byte[] byteArr)
get Int From Byte Array
return ByteBuffer.wrap(byteArr).getInt();
intgetIntFromByteArray(final byte[] bytes)
Converts a byte array to an int.
return ByteBuffer.wrap(bytes).getInt();
intgetIntLE2(byte[] b, int offset)
get Int LE
return ((b[offset + 1] & 0xff) << 8) | (b[offset] & 0xff);