Here you can find the source of toInt(byte[] b)
public static int toInt(byte[] b)
//package com.java2s; public class Main { public static int toInt(byte[] b) { int value = 0; for (int x = 0; x < b.length; x++) { value |= b[x] & 0xFF;/*w w w . ja v a 2 s . c o m*/ // if it's the last one, don't shift if (x != b.length - 1) { value <<= 8; } } return value; } public static int toInt(byte b) { byte[] x = { b }; return toInt(x); } }