protected static int grabInt ( byte [ ] bytes , int offset , boolean littleEndianData ) { int ndx0 = offset + ( littleEndianData ? 3 : 0 ) ; int ndx1 = offset + ( littleEndianData ? 2 : 1 ) ; int ndx2 = offset + ( littleEndianData ? 1 : 2 ) ; int ndx3 = offset + ( littleEndianData ? 0 : 3 ) ; // careful that we only allow sign extension on the highest order byte return ( bytes [ ndx0 ] << 24 | ( bytes [ ndx1 ] & 0xff ) << 16 | ( bytes [ ndx2 ] & 0xff ) << 8 | ( bytes [ ndx3 ] & 0xff ) ) ; }
Unpack a four - byte integer from the given byte array .