Java Integer Create toInt(byte[] b)

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

Description

to Int

License

Apache License

Declaration

public static int toInt(byte[] b) 

Method Source Code

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

public class Main {
    public static int toInt(byte[] b) {
        if (b.length > 4)
            throw new NumberFormatException("int has only 4 bytes");
        int i = 0;
        for (byte x : b) {
            i <<= 8;//  w w w  .j  av  a2s.com
            i |= (x & 0xFF);
        }
        return i;
    }
}

Related

  1. toInt(byte[] b)
  2. toInt(byte[] b)
  3. toInt(byte[] b)
  4. toInt(byte[] b)
  5. toInt(byte[] b)
  6. toInt(byte[] b)
  7. toInt(byte[] b, int begin_index, int len)
  8. toInt(byte[] block, int pos, int len)
  9. toInt(byte[] bRefArr)