Here you can find the source of toInt(byte[] b)
public static int toInt(byte[] b)
//package com.java2s; //License from project: Apache License public class Main { public static int toInt(byte[] b) { if (b.length > 4) throw new NumberFormatException("int has only 4 bytes"); int i = 0; for (byte x : b) { i <<= 8;// w w w .j av a2s.com i |= (x & 0xFF); } return i; } }