Here you can find the source of bytesToInt(byte[] bytes)
public static int bytesToInt(byte[] bytes)
//package com.java2s; //License from project: Apache License public class Main { public static int bytesToInt(byte[] bytes) { return (0xff & bytes[0]) | (0xff00 & (bytes[1] << 8)) | (0xff0000 & (bytes[2] << 16)) | (0xff000000 & (bytes[3] << 24)); }//from ww w. jav a 2 s .c om public static int bytesToInt(byte[] b, int offset) { return (0xff & b[offset]) | (0xff00 & (b[offset + 1] << 8)) | (0xff0000 & (b[offset + 2] << 16)) | (0xff000000 & (b[offset + 3] << 24)); } }