public static byte[] reverseDwordBytes(byte[] bytes,int trimLength){
  checkArgument(bytes.length % 4 == 0);
  checkArgument(trimLength < 0 || trimLength % 4 == 0);
  byte[] rev=new byte[trimLength >= 0 && bytes.length > trimLength ? trimLength : bytes.length];
  for (int i=0; i < rev.length; i+=4) {
    System.arraycopy(bytes,i,rev,i,4);
    for (int j=0; j < 4; j++) {
      rev[i + j]=bytes[i + 3 - j];
    }
  }
  return rev;
}

public static byte [ ] reverseDwordBytes ( byte [ ] bytes , int trimLength ) { checkArgument ( bytes . length % 4 == 0 ) ; checkArgument ( trimLength < 0 || trimLength % 4 == 0 ) ; byte [ ] rev = new byte [ trimLength >= 0 && bytes . length > trimLength ? trimLength : bytes . length ] ; for ( int i = 0 ; i < rev . length ; i += 4 ) { System . arraycopy ( bytes , i , rev , i , 4 ) ; for ( int j = 0 ; j < 4 ; j ++ ) { rev [ i + j ] = bytes [ i + 3 - j ] ; } } return rev ; }
returns a copy of the given byte array with the bytes of each double - word ( 4 bytes ) reversed .
