Possible Duplicate:
byte array to Int Array
I have a large array of bytes, can I somehow interpret it as an array of ints, such that each entry is just four of the original bytes?
I mean something like this:
for (int i = 0; i < byteArray.length; i += 4) {
intArray[i / 4] = byteArray[i] << 24 + byteArray[i+1] << 16 + byteArray[i+2] << 8 + byteArray[i+3];
}
but rather than copying the whole array byte by byte which takes forever because the array is huge, just read ints off the array that already exists.