static public int swapInt ( byte [ ] b , int offset ) { // 4 bytes int accum = 0 ; for ( int shiftBy = 0 , i = offset ; shiftBy < 32 ; shiftBy += 8 , i ++ ) { accum |= ( b [ i ] & 0xff ) << shiftBy ; } return accum ; }
Returns the int resulting from reversing 4 bytes at a specified offset in a byte array .