Java Array Deep Copy deepCopy2DArray(float[][] a)

Here you can find the source of deepCopy2DArray(float[][] a)

Description

deep Copy D Array

License

Open Source License

Declaration

public static float[][] deepCopy2DArray(float[][] a) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Arrays;

public class Main {
    public static float[][] deepCopy2DArray(float[][] a) {
        if (a == null) {
            return null;
        }// w ww  .  j av  a2 s . c o  m
        float[][] result = new float[a.length][];
        for (int i = 0; i < a.length; i++) {
            // copyOf suffices only because these are primitives:
            result[i] = Arrays.copyOf(a[i], a[i].length);
        }
        return result;
    }
}

Related

  1. deepCopy(double[][] in)
  2. deepCopy(final String s)
  3. deepCopy(int[] array)
  4. deepCopy(int[][] src, int[][] dest)
  5. deepCopy(Object objectArray)
  6. deepCopyOf(double[][] src)