Here you can find the source of swapTwoRows(byte[][] pattern, int row1, int row2)
public static byte[][] swapTwoRows(byte[][] pattern, int row1, int row2)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[][] swapTwoRows(byte[][] pattern, int row1, int row2) { // TODO: Testing is key. Do I *have* to use Arrays.copy, or clone(), or something? byte[] temp_row = pattern[row1]; pattern[row1] = pattern[row2];/*from w w w . ja v a 2 s. c om*/ pattern[row2] = temp_row; return pattern; } public static int[][] swapTwoRows(int[][] pattern, int row1, int row2) { // TODO: Testing is key. Do I *have* to use Arrays.copy, or clone(), or something? int[] temp_row = pattern[row1]; pattern[row1] = pattern[row2]; pattern[row2] = temp_row; return pattern; } public static <E> E[][] swapTwoRows(E[][] pattern, int row1, int row2) { // TODO: Testing is key. Do I *have* to use Arrays.copy, or clone(), or something? E[] temp_row = pattern[row1]; pattern[row1] = pattern[row2]; pattern[row2] = temp_row; return pattern; } }