Java Matrix Swap swapTwoRows(byte[][] pattern, int row1, int row2)

Here you can find the source of swapTwoRows(byte[][] pattern, int row1, int row2)

Description

swap Two Rows

License

Open Source License

Declaration

public static byte[][] swapTwoRows(byte[][] pattern, int row1, int row2) 

Method Source Code

//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;
    }
}

Related

  1. swapRows(double[][] a, int i, int j)
  2. swapRows(double[][] Ab, int k, int i)
  3. swapRows(double[][] matrix, int i1, int i2)
  4. swapShorts(byte bs[][])
  5. swapTwoBlocks(int[][] pattern, int block1, int block2)