Android Utililty Methods Big Endian Convert

List of utility methods to do Big Endian Convert

Description

The list of methods to do Big Endian Convert are organized into topic(s).

Method

voidsetBigIndianInBytesArray(byte[] toPutIn, int startidx, long theNumber, int len)
put number in array (big endian way)
for (int i = 0; i < len; i++) {
    long num = (theNumber >> (8 * (len - (i + 1)))) & 0xff;
    toPutIn[i + startidx] = (byte) num;
voidsetLittleIndianInBytesArray(byte[] toPutIn, int startidx, long theNumber, int len)
put number in array (big endian way)
for (int i = 0; i < len; i++) {
    toPutIn[i + startidx] = (byte) (theNumber % 256);
    theNumber /= 256;