Here you can find the source of bytesToInt(byte[] data)
public static int bytesToInt(byte[] data)
//package com.java2s; //License from project: Apache License public class Main { public static int bytesToInt(byte[] data) { return bytesToInt(data, 0); }//from w ww . j ava 2s . co m public static int bytesToInt(byte[] data, int offset) { assert (data.length - offset >= 4); return (data[offset]) | (data[offset + 1] << 1) | (data[offset + 2] << 2) | (data[offset + 3] << 3); } }