Java Integer Create toInt(byte[] value)

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

Description

to Int

License

Open Source License

Declaration

public static int toInt(byte[] value) 

Method Source Code

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

public class Main {
    public static int toInt(byte[] value) {
        return toInt(value, 0);
    }/*from   ww  w  .  j  a  v  a2 s. c  o m*/

    /**
     * byte[] -> int
     * 
     * @param value
     * @param offset
     * @return
     */
    public static int toInt(byte[] value, int offset) {
        int result = 0;
        result = result | (value[offset + 3] & 0xff);
        result = result | ((((int) value[offset + 2] & 0xff)) << 8);
        result = result | ((((int) value[offset + 1] & 0xff)) << 16);
        result = result | ((((int) value[offset + 0] & 0xff)) << 24);
        return result;
    }
}

Related

  1. toInt(byte[] si)
  2. toInt(byte[] src)
  3. toInt(byte[] src)
  4. toInt(byte[] src, int srcPos)
  5. toInt(byte[] value)
  6. toInt(char msc, char lsc)
  7. toInt(char[] bytes, boolean le)
  8. toInt(double d)
  9. toInt(double d)