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

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

Description

byte To Int

License

Apache License

Declaration

public static int byteToInt2(byte[] b) 

Method Source Code

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

public class Main {
    public static int byteToInt2(byte[] b) {

        int iOutcome = 0;
        byte bLoop;

        for (int i = 0; i < 4; i++) {
            bLoop = b[i];//from  ww  w. j  a  v a 2  s.  co m
            int off = (b.length - 1 - i) * 8;
            iOutcome += (bLoop & 0xFF) << off;

        }

        return iOutcome;
    }
}

Related

  1. byteToInt(byte[] i_Value)
  2. byteToInt(byte[] num)
  3. byteToInt(byte[] source, int sourceOffset)
  4. byteToInt(byte[] values)
  5. byteToInt(final byte[] b)
  6. byteToInteger(byte[] b)