Here you can find the source of toInt(byte... b)
public static int toInt(byte... b)
//package com.java2s; /**//from w ww. ja v a 2 s .c o m * License * * Licensed under the GNU GPL v3 * http://www.gnu.org/licenses/gpl.html * */ public class Main { public static int toInt(byte... b) { return (int) toLong(b); } public static long toLong(byte... b) { long l = 0; int len = b.length; for (int i = 0; i < len && i < 8; i++) { l = (long) l << 8 | byte2UnsignInt(b[i]); } return l; } public static int byte2UnsignInt(byte b) { if (b >> 1 == b >>> 1) return b; else return 256 + b; } }