Java Array Copy copy5DArray(char[][][][][] original)

Here you can find the source of copy5DArray(char[][][][][] original)

Description

copy D Array

License

Open Source License

Declaration

public static char[][][][][] copy5DArray(char[][][][][] original) 

Method Source Code


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

import java.util.Arrays;

public class Main {
    public static char[][][][][] copy5DArray(char[][][][][] original) {
        char[][][][][] result = new char[original.length][][][][];
        for (int i = 0; i < original.length; i++) {
            result[i] = new char[original[i].length][][][];
            for (int j = 0; j < original[i].length; j++) {
                result[i][j] = new char[original[i][j].length][][];
                for (int k = 0; k < original[i][j].length; k++) {
                    result[i][j][k] = copy2DArray(original[i][j][k]);
                }/* w ww.ja  v  a  2 s.  co  m*/
            }
        }
        return result;
    }

    public static char[][] copy2DArray(char[][] original) {
        char[][] result = new char[original.length][];
        for (int i = 0; i < original.length; i++) {
            result[i] = Arrays.copyOf(original[i], original[i].length);
        }
        return result;
    }

    public static int[][] copy2DArray(int[][] original) {
        int[][] result = new int[original.length][];
        for (int i = 0; i < original.length; i++) {
            result[i] = Arrays.copyOf(original[i], original[i].length);
        }
        return result;
    }
}

Related

  1. copy(long[] array)
  2. copy(long[] v)
  3. copy(T[] array)
  4. copy(T[] array)
  5. copy2DArray(char[][] original)
  6. copyAndFillOf(T[] original, int newLength, T padding)
  7. copyArray()
  8. copyArray(byte[] dest, int off, byte[] src)
  9. copyArray(byte[] original, int start, int length)