Android Byte Array to Int Convert toInt(byte[] in)

Here you can find the source of toInt(byte[] in)

Description

to Int

License

LGPL

Declaration

public static int toInt(byte[] in) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    public static int toInt(byte[] in) {
        int out = 0;
        for (int i = in.length - 1; i > 0; i--) {
            out |= in[i] & 0xff;/*from   ww  w .  j  a va 2  s.  com*/
            out <<= 8;
        }
        out |= in[0] & 0xff;
        return out;
    }
}

Related

  1. bytesToInt(byte[] bytes)
  2. bytesToInt(byte[] bytes, int offset)
  3. swap32bitFromArray(byte[] value, int offset)
  4. swap32bitsToArray(int value, byte[] dest, int offset)
  5. swapU16bitFromArray(byte[] value, int offset)
  6. parseInt(byte[] b, int start, int end, int radix)
  7. parseInt(byte[] b, int start, int end)
  8. buildInt(byte first, byte second)
  9. extractInt(byte[] data, int offset)