Here you can find the source of copyMatrix(boolean[][] old)
public static boolean[][] copyMatrix(boolean[][] old)
//package com.java2s; //License from project: Apache License public class Main { public static boolean[][] copyMatrix(boolean[][] old) { return copyMatrix(old, old.length); }//from www . j av a 2s .c om public static boolean[][] copyMatrix(boolean[][] old, int upToRow) { int m = Math.min(old.length, upToRow); if (m == 0) { return null; } int n = old[0].length; boolean[][] duplicate = new boolean[m][n]; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { duplicate[i][j] = old[i][j]; } } return duplicate; } }