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) { return bytesToInt(b[0], b[1], b[2], b[3]); }// w w w . j a v a2 s . com public static int bytesToInt(byte b1, byte b2, byte b3, byte b4) { int answer = 0xFF & b4; answer = answer << 8 | (0xFF & b3); answer = answer << 8 | (0xFF & b2); answer = answer << 8 | (0xFF & b1); return answer; } }