Here you can find the source of bytes2int(byte[] bytes)
public static int bytes2int(byte[] bytes)
//package com.java2s; //License from project: Apache License public class Main { public static int bytes2int(byte[] bytes) { int num = 0; for (int i = 0; i < 4; i++) { num <<= 8;/*from w w w.j av a2s. c om*/ num |= (bytes[i] & 0xff); } return num; } public static int bytes2int(byte[] bytes, int offset) { int num = 0; for (int i = offset; i < offset + 4; i++) { num <<= 8; num |= (bytes[i] & 0xff); } return num; } }