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 LENGTH_SIZE = 4;

    public static int toInt(byte[] b) {
        assert (b.length == LENGTH_SIZE);
        int n = 0;
        n |= ((b[0] & 0x000000FF) << 3 * 8);
        n |= ((b[1] & 0x000000FF) << 2 * 8);
        n |= ((b[2] & 0x000000FF) << 1 * 8);
        n |= (b[3] & 0x000000FF);/*from  w w  w .  j  a v a2s  .co  m*/
        return n;
    }
}

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)
  8. toInt(byte[] b)
  9. toInt(byte[] b)