Here you can find the source of bytes2int(byte[] bytes, int offset, boolean bigEndian)
public static int bytes2int(byte[] bytes, int offset, boolean bigEndian)
//package com.java2s; //License from project: Apache License public class Main { public static int bytes2int(byte[] bytes, boolean bigEndian) { return bytes2int(bytes, 0, bigEndian); }// w w w. j a v a 2 s . co m public static int bytes2int(byte[] bytes, int offset, boolean bigEndian) { int val = 0; if (bigEndian) { val += (bytes[offset + 0] & 0xff) << 24; val += (bytes[offset + 1] & 0xff) << 16; val += (bytes[offset + 2] & 0xff) << 8; val += (bytes[offset + 3] & 0xff); } else { val += (bytes[offset + 3] & 0xff) << 24; val += (bytes[offset + 2] & 0xff) << 16; val += (bytes[offset + 1] & 0xff) << 8; val += (bytes[offset + 0] & 0xff); } return val; } }