Here you can find the source of toInt(byte[] bytes)
public static int toInt(byte[] bytes)
//package com.java2s; public class Main { public static int toInt(byte[] bytes) { int result = 0; int base = 1; for (int i = bytes.length - 1; i >= 0; i--) { result = result + (toInt(bytes[i]) * base); base = base * 256;/*from www.java2 s. c o m*/ } return result; } public static int toInt(byte b) { int result = b; if (result < 0) { result = result + 256; } return result; } }