Here you can find the source of bytes2Int(byte[] data)
public static int bytes2Int(byte[] data)
//package com.java2s; public class Main { public static int bytes2Int(byte[] data) { if (data.length == 1) { return (int) data[0]; } else {// w w w . java2s.c o m int mask = 0xff; int temp = 0; int n = 0; for (int i = 0; i < 4; i++) { n <<= 8; temp = data[i] & mask; n |= temp; } return n; } } }