private void swapBlocks(int from,int second,int to){
  int len1=second - from, len2=to - second + 1;
  if (len1 == 0 || len2 == 0) {
    return;
  }
  if (len1 < temp.length) {
    System.arraycopy(data,from,temp,0,len1);
    System.arraycopy(data,second,data,from,len2);
    System.arraycopy(temp,0,data,from + len2,len1);
    return;
  }
 else   if (len2 < temp.length) {
    System.arraycopy(data,second,temp,0,len2);
    System.arraycopy(data,from,data,from + len2,len1);
    System.arraycopy(temp,0,data,from,len2);
    return;
  }
  reverseBlock(from,second - 1);
  reverseBlock(second,to);
  reverseBlock(from,to);
}

private void swapBlocks ( int from , int second , int to ) { int len1 = second - from , len2 = to - second + 1 ; if ( len1 == 0 || len2 == 0 ) { return ; } if ( len1 < temp . length ) { System . arraycopy ( data , from , temp , 0 , len1 ) ; System . arraycopy ( data , second , data , from , len2 ) ; System . arraycopy ( temp , 0 , data , from + len2 , len1 ) ; return ; } else if ( len2 < temp . length ) { System . arraycopy ( data , second , temp , 0 , len2 ) ; System . arraycopy ( data , from , data , from + len2 , len1 ) ; System . arraycopy ( temp , 0 , data , from , len2 ) ; return ; } reverseBlock ( from , second - 1 ) ; reverseBlock ( second , to ) ; reverseBlock ( from , to ) ; }
swap the elements of two blocks in the data array . both blocks are next to each other ( the second block starts just after the first block ends ) .
