Android examples for java.lang:array convert
convert byte array to int
public class Main{ public static int byteArray2Int(byte[] array) { int reuslt = 0; byte loop; for (int i = 0; i < 4; i++) { loop = array[i];// w w w .ja va 2s .co m int offset = array.length - i - 1; reuslt += (loop & 0xFF) << (8 * offset); } return reuslt; } }