Here you can find the source of byte2Int(byte[] b)
public static int byte2Int(byte[] b)
//package com.java2s; //License from project: Apache License public class Main { public static int byte2Int(byte[] b) { int intValue = 0; // int tempValue = 0xFF; for (int i = 0; i < b.length; i++) { intValue += (b[i] & 0xFF) << (8 * (3 - i)); // System.out.print(Integer.toBinaryString(intValue)+" "); }//from w ww . jav a2s. c o m return intValue; } }