Java Integer Convert To convertInt(byte[] data)

Here you can find the source of convertInt(byte[] data)

Description

convert Int

License

LGPL

Declaration

public static long convertInt(byte[] data) 

Method Source Code

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

public class Main {
    public static long convertInt(byte[] data) {
        return ((data[3] & 0xFF) << 24) | ((data[2] & 0xFF) << 16) | ((data[1] & 0xFF) << 8) | (data[0] & 0xFF);
    }/*from w  w w . j a  v  a2  s  . co m*/

    public static long convertInt(byte[] data, int offset) {
        byte[] target = new byte[4];
        System.arraycopy(data, offset, target, 0, target.length);
        return convertInt(target);
    }
}

Related

  1. convertInt(byte[] data)
  2. convertInt(String str, int defaults)
  3. convertInt(String str, int radix)
  4. convertInt(String value)
  5. convertInt(String valueAsString)