Android Byte Array to Unicode Convert byteArrayLittleEndian2Int(byte[] bs)

Here you can find the source of byteArrayLittleEndian2Int(byte[] bs)

Description

byte Array Little Endian Int

License

Open Source License

Declaration

public static int byteArrayLittleEndian2Int(byte[] bs) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static final int BYTE_MASK = 0xff;

    public static int byteArrayLittleEndian2Int(byte[] bs) {
        if (bs.length != 4)
            throw new IllegalArgumentException();
        int res = 0;
        res |= (bs[3] & BYTE_MASK) << 24;
        res |= (bs[2] & BYTE_MASK) << 16;
        res |= (bs[1] & BYTE_MASK) << 8;
        res |= (bs[0] & BYTE_MASK);// www . j a  va 2 s. c o m
        return res;

    }
}

Related

  1. byteArrayBigEndian2Int(byte[] bs)
  2. bytesToAsciiMaybe(byte[] data)
  3. bytesToAsciiMaybe(byte[] data, int offset, int length)
  4. lowerToUpper(byte[] b)
  5. lowerToUpperLatin(byte[] b)