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) {
        int s = 0;
        int s0 = b[0] & 0xff;
        int s1 = b[1] & 0xff;
        int s2 = b[2] & 0xff;
        int s3 = b[3] & 0xff;
        s3 <<= 24;/*  w w  w  .jav  a  2 s . c o m*/
        s2 <<= 16;
        s1 <<= 8;
        s = s0 | s1 | s2 | s3;
        return s;
    }
}

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, int begin_index, int len)
  9. toInt(byte[] block, int pos, int len)