Here you can find the source of bytesToInt(byte[] b)
public static int bytesToInt(byte[] b)
//package com.java2s; public class Main { public static int bytesToInt(byte[] b) { int mask = 0xff; int temp = 0; int n = 0; for (int i = 0; i < b.length; i++) { n <<= 8;//from w ww . j av a 2 s . c om temp = b[i] & mask; n |= temp; } return n; } }