Java Byte Array to Int byteToInt(byte[] b)

Here you can find the source of byteToInt(byte[] b)

Description

byte To Int

License

Open Source License

Declaration

public static int byteToInt(byte[] b) 

Method Source Code

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

public class Main {
    public static int byteToInt(byte[] b) {
        int s = 0;
        int s0 = b[0] & 0xff;
        int s1 = b[1] & 0xff;
        int s2 = b[2] & 0xff;
        int s3 = b[3] & 0xff;
        s3 <<= 24;/*from   ww  w.  ja  v  a2  s. c o m*/
        s2 <<= 16;
        s1 <<= 8;
        s = s0 | s1 | s2 | s3;
        return s;
    }
}

Related

  1. bytesToInts(byte[] bytes, int shift, int[] spec)
  2. bytesToInts(byte[] data)
  3. bytesToInts(byte[][] bytes)
  4. byteToInt(byte b[])
  5. byteToInt(byte[] b)
  6. byteToInt(byte[] bank)
  7. byteToInt(byte[] buf, int off)
  8. byteToInt(byte[] byteArray)
  9. byteToInt(byte[] bytes)