Here you can find the source of toInt(byte[] bytes)
public static int toInt(byte[] bytes)
//package com.java2s; //License from project: Apache License public class Main { public static int toInt(byte[] bytes) { int num = 0; if (bytes != null) { for (int i = bytes.length - 1, j = 0; i >= 0; i--, j++) { num += (long) (bytes[i] & 0xff) << (j * 8); }/* ww w.j a va2s . co m*/ } return num; } }