Android Utililty Methods Byte to Int Convert

List of utility methods to do Byte to Int Convert

Description

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

Method

intgetInt(byte b1, byte b2)
Gets an int from two bytes
int i1 = b1 & 0xff;
int i2 = b2 & 0xff;
int val = i2 << 8 | i1;
return val;
intgetInt(byte b1, byte b2, byte b3, byte b4)
Gets an int from four bytes, doing all the necessary swapping
int i1 = getInt(b1, b2);
int i2 = getInt(b3, b4);
int val = i2 << 16 | i1;
return val;
intmakeInt(byte b3, byte b2, byte b1, byte b0)
make Int
return (int) ((((b3 & 0xff) << 24) | ((b2 & 0xff) << 16)
        | ((b1 & 0xff) << 8) | ((b0 & 0xff) << 0)));