copy Matrix - Java java.lang

Java examples for java.lang:Math Matrix

Description

copy Matrix

Demo Code


//package com.java2s;

public class Main {
    public static boolean[][] copyMatrix(boolean[][] matrix) {
        int maxY = matrix.length;
        int maxX = matrix[0].length;
        boolean[][] copy = new boolean[maxY][maxX];
        for (int y = 0; y < maxY; y++) {
            for (int x = 0; x < maxX; x++) {
                copy[y][x] = matrix[y][x];
            }/* w w  w. j  av  a 2s.co m*/
        }
        return copy;
    }
}

Related Tutorials