Java Byte Array to Int byte2int(byte b[], int offset)

Here you can find the source of byte2int(byte b[], int offset)

Description

byteint

License

Open Source License

Declaration

public static int byte2int(byte b[], int offset) 

Method Source Code

//package com.java2s;

public class Main {
    /** *///from www .j  a v  a 2 s  . c o m
    public static int byte2int(byte b[], int offset) {
        int val = 0;
        int bits = 32;
        int tval;

        for (int i = 0; i < 4; i++) {
            bits -= 8;
            tval = b[offset + i];
            tval = tval < 0 ? 256 + tval : tval;
            val |= tval << bits;
        }

        return val;
    }
}

Related

  1. arr2int(byte[] arr, int start)
  2. bufferToInt(byte[] ioBuffer)
  3. byte2Int(byte bytes[])
  4. byte2Int(byte[] b)
  5. byte2int(final byte[] arr)
  6. byte2int(int[] output, byte[] input, int ioff, int len)