Here you can find the source of cloneMatrix(final double[][] matrix)
public static double[][] cloneMatrix(final double[][] matrix)
//package com.java2s; //License from project: Open Source License public class Main { public static double[][] cloneMatrix(final double[][] matrix) { final int m = matrix.length; int n = matrix[0].length; final double[][] outMatrix = new double[m][n]; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { outMatrix[i][j] = matrix[i][j]; }/*ww w.j a va 2s.c om*/ } return outMatrix; } }