Here you can find the source of clone2DArray(double[][] a)
Parameter | Description |
---|---|
a | The matrix to copy. |
public static double[][] clone2DArray(double[][] a)
//package com.java2s; //License from project: Open Source License public class Main { /**// ww w. j av a 2 s .c o m * Clones a two-dimensional matrix. * @param a The matrix to copy. * @return A clone of the matrix or null if parameter a is null. */ public static double[][] clone2DArray(double[][] a) { if (a == null) return null; double[][] copy = new double[a.length][a.length == 0 ? 0 : a[0].length]; for (int i = 0; i < a.length; i++) { System.arraycopy(a[i], 0, copy[i], 0, a[i].length); } return copy; } }