Here you can find the source of toInt(byte[] bytes, int offset)
public static int toInt(byte[] bytes, int offset)
//package com.java2s; //License from project: Open Source License public class Main { public static int toInt(byte[] bytes, int offset) { int ret = 0; for (int i = 0; i < 4 && i + offset < bytes.length; i++) { ret <<= 8;/*from ww w . jav a 2 s .co m*/ ret |= (int) bytes[i] & 0xFF; } return ret; } }