Java Integer Create toInt(byte... b)

Here you can find the source of toInt(byte... b)

Description

to Int

License

Open Source License

Declaration

public static int toInt(byte... b) 

Method Source Code

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

public class Main {

    public static int toInt(byte... b) {
        return (int) toLong(b);
    }// w  w w .  j a  v a2  s.c o  m

    public static long toLong(byte... b) {
        int mask = 0xff;
        int temp = 0;
        long res = 0;
        int byteslen = b.length;
        if (byteslen > 8) {
            return Long.valueOf(0L);
        }
        for (int i = 0; i < byteslen; i++) {
            res <<= 8;
            temp = b[i] & mask;
            res |= temp;
        }
        return res;
    }
}

Related

  1. toInt(byte in0, byte in1, byte in2, byte in3)
  2. toInt(byte mostSignificant, byte leastSignificant)
  3. toInt(byte src)
  4. toInt(byte value)
  5. toInt(byte... b)
  6. toInt(byte[] b)
  7. toInt(byte[] b)
  8. toInt(byte[] b)
  9. toInt(byte[] b)