Here you can find the source of swapTwoBlocks(int[][] pattern, int block1, int block2)
public static int[][] swapTwoBlocks(int[][] pattern, int block1, int block2)
//package com.java2s; //License from project: Open Source License public class Main { public static int[][] swapTwoBlocks(int[][] pattern, int block1, int block2) { // TODO: Testing is key. Do I *have* to use Arrays.copy, or clone(), or something? int[] temp_row1 = pattern[0 + 3 * block1]; int[] temp_row2 = pattern[1 + 3 * block1]; int[] temp_row3 = pattern[2 + 3 * block1]; pattern[0 + 3 * block1] = pattern[0 + 3 * block2]; pattern[1 + 3 * block1] = pattern[1 + 3 * block2]; pattern[2 + 3 * block1] = pattern[2 + 3 * block2]; pattern[0 + 3 * block2] = temp_row1; pattern[1 + 3 * block2] = temp_row2; pattern[2 + 3 * block2] = temp_row3; return pattern; }//w w w . j a va 2s .com public static <E> E[][] swapTwoBlocks(E[][] pattern, int block1, int block2) { // TODO: Testing is key. Do I *have* to use Arrays.copy, or clone(), or something? E[] temp_row1 = pattern[0 + 3 * block1]; E[] temp_row2 = pattern[1 + 3 * block1]; E[] temp_row3 = pattern[2 + 3 * block1]; pattern[0 + 3 * block1] = pattern[0 + 3 * block2]; pattern[1 + 3 * block1] = pattern[1 + 3 * block2]; pattern[2 + 3 * block1] = pattern[2 + 3 * block2]; pattern[0 + 3 * block2] = temp_row1; pattern[1 + 3 * block2] = temp_row2; pattern[2 + 3 * block2] = temp_row3; return pattern; } }