Here you can find the source of toInt(byte[] buf)
static int toInt(byte[] buf)
//package com.java2s; //License from project: Apache License public class Main { static int toInt(byte[] buf) { int n = 0; for (byte b : buf) { n = (n << 8) + (b & 0xff); }//from w ww . ja v a 2s. com return n; } }