ByteArrayOutStream.toByteArray(), : byte[]. , , [] int.
You can do this :
public static int byteArrayToInt(byte[] b) {
return byteArrayToInt(b, 0);
}
public static int byteArrayToInt(byte[] b, int offset) {
int value = 0;
for (int i = 0; i < 4; i++) {
int shift = (4 - 1 - i) * 8;
value += (b[i + offset] & 0x000000FF) << shift;
}
return value;
}
zengr source
share