Here you can find the source of bytesToInt(byte[] b)
public static int bytesToInt(byte[] b)
//package com.java2s; //License from project: Apache License public class Main { public static int bytesToInt(byte[] b) { int i = (b[0] << 24) & 0xFF000000; i |= (b[1] << 16) & 0xFF0000; i |= (b[2] << 8) & 0xFF00; i |= b[3] & 0xFF;/*from w w w .j a va 2 s.com*/ return i; } public static int bytesToInt(byte[] bytes, int start) { int num = bytes[start] & 0xFF; num |= ((bytes[start + 1] << 8) & 0xFF00); num |= ((bytes[start + 2] << 16) & 0xFF0000); num |= ((bytes[start + 3] << 24) & 0xFF000000); return num; } }