Since a two-dimensional array in java is actually an array of references to other arrays, you can simply replace the links as shown below:
public static void swapRows(int array[][], int rowA, int rowB) { int tmpRow[] = array[rowA]; array[rowA] = array[rowB]; array[rowB] = tmpRow; }
/ edit : edited the answer since I misinterpreted it earlier **
source share