Here you can find the source of copyMatrix(final int rowsCount, final int columnsCount, final double[][] origMatrix)
public static double[][] copyMatrix(final int rowsCount, final int columnsCount, final double[][] origMatrix)
//package com.java2s; public class Main { public static double[][] copyMatrix(final int rowsCount, final int columnsCount, final double[][] origMatrix) { final double[][] copiedMatrix = new double[rowsCount][columnsCount]; for (int i = 0; i <= rowsCount; i++) { copiedMatrix[i] = new double[columnsCount]; System.arraycopy(origMatrix[i], 0, copiedMatrix[i], 0, columnsCount); }/*from w w w . jav a2 s .c om*/ return copiedMatrix; } }