public void swap(int i, int j) {
    checkBounds(i);
    checkBounds(j);

    if (i == j)
      return;

    copier.copy(tmp, offset(i));
    unsafe.copyMemory(null, offset(j), null, offset(i), elementSpacing);
    unsafe.copyMemory(tmp, firstFieldOffset, null, offset(j), elementSize);
  }
public void swap ( int i , int j ) { checkBounds ( i ) ; checkBounds ( j ) ; if ( i == j ) return ; copier . copy ( tmp , offset ( i ) ) ; unsafe . copyMemory ( null , offset ( j ) , null , offset ( i ) , elementSpacing ) ; unsafe . copyMemory ( tmp , firstFieldOffset , null , offset ( j ) , elementSize ) ; }
Swaps two elements

@param i Index of first element
@param j Index of second element