Here you can find the source of bytesToInt(byte[] bytes)
public static final int bytesToInt(byte[] bytes)
//package com.java2s; /**//ww w .jav a2 s.c om * Licensed to LGPL v3. */ public class Main { public static final int bytesToInt(byte[] bytes) { int value = 0; for (int i = 0; i < 4; i++) { int shift = (4 - 1 - i) * 8; value += (bytes[i] & 0x000000FF) << shift; } return value; } }