Android Byte Array to Int Convert bytes2int(byte[] data)

Here you can find the source of bytes2int(byte[] data)

Description

bytesint

Declaration

public static int bytes2int(byte[] data) 

Method Source Code

//package com.java2s;

public class Main {
    public static int bytes2int(byte[] data) {
        int val = 0;

        val |= data[0] & 0x000000FF;
        val |= (data[1] << 8) & 0x0000FF00;
        val |= (data[2] << 16) & 0x00FF0000;
        val |= (data[3] << 24) & 0xFF000000;

        return val;
    }//from  w  w w . j  a  v  a 2 s  .  com
}

Related

  1. toIntFromTwoBytes(byte[] b, int pos)
  2. toInteger(byte[] b, int pos)
  3. toInteger(byte[] b, int pos, int width)
  4. toInts(byte... bytes)
  5. byteArrayToInt(byte[] b)
  6. byte2int(byte[] b)
  7. byteArray2Int(byte[] bs)
  8. byteArrayToInt(byte[] b)
  9. toIntegerArray(byte[] input, int offset, int len)