Java Array Clone clone(double[] p)

Here you can find the source of clone(double[] p)

Description

clone

License

Open Source License

Declaration

public static double[] clone(double[] p) 

Method Source Code

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

public class Main {
    public static double[] clone(double[] p) {
        double[] ret = new double[p.length];
        System.arraycopy(p, 0, ret, 0, p.length);
        return ret;
    }// www  .java 2  s  . co m

    public static float[] clone(float[] p) {
        float[] ret = new float[p.length];
        System.arraycopy(p, 0, ret, 0, p.length);
        return ret;
    }

    public static int[] clone(int[] p) {
        int[] ret = new int[p.length];
        System.arraycopy(p, 0, ret, 0, p.length);
        return ret;
    }

    public static byte[] clone(byte[] p) {
        byte[] ret = new byte[p.length];
        System.arraycopy(p, 0, ret, 0, p.length);
        return ret;
    }

    public static char[] clone(char[] p) {
        char[] ret = new char[p.length];
        System.arraycopy(p, 0, ret, 0, p.length);
        return ret;
    }

    public static long[] clone(long[] p) {
        long[] ret = new long[p.length];
        System.arraycopy(p, 0, ret, 0, p.length);
        return ret;
    }

    public static short[] clone(short[] p) {
        short[] ret = new short[p.length];
        System.arraycopy(p, 0, ret, 0, p.length);
        return ret;
    }

    public static String[] clone(String[] p) {
        String[] ret = new String[p.length];
        System.arraycopy(p, 0, ret, 0, p.length);
        return ret;
    }

    public static boolean[] clone(boolean[] p) {
        boolean[] ret = new boolean[p.length];
        System.arraycopy(p, 0, ret, 0, p.length);
        return ret;
    }

    public static double[][] clone(double[][] p) {
        double[][] ret = new double[p.length][p[0].length];
        int nr = p.length;
        for (int i = 0; i < nr; i++) {
            System.arraycopy(p[i], 0, ret[i], 0, p[0].length);
        }
        return ret;
    }

    public static float[][] clone(float[][] p) {
        float[][] ret = new float[p.length][p[0].length];
        int nr = p.length;
        for (int i = 0; i < nr; i++) {
            System.arraycopy(p[i], 0, ret[i], 0, p[0].length);
        }
        return ret;
    }

    public static int[][] clone(int[][] p) {
        int[][] ret = new int[p.length][p[0].length];
        int nr = p.length;
        for (int i = 0; i < nr; i++) {
            System.arraycopy(p[i], 0, ret[i], 0, p[0].length);
        }
        return ret;
    }

    public static long[][] clone(long[][] p) {
        long[][] ret = new long[p.length][p[0].length];
        int nr = p.length;
        for (int i = 0; i < nr; i++) {
            System.arraycopy(p[i], 0, ret[i], 0, p[0].length);
        }
        return ret;
    }

    public static short[][] clone(short[][] p) {
        short[][] ret = new short[p.length][p[0].length];
        int nr = p.length;
        for (int i = 0; i < nr; i++) {
            System.arraycopy(p[i], 0, ret[i], 0, p[0].length);
        }
        return ret;
    }

    public static byte[][] clone(byte[][] p) {
        byte[][] ret = new byte[p.length][p[0].length];
        int nr = p.length;
        for (int i = 0; i < nr; i++) {
            System.arraycopy(p[i], 0, ret[i], 0, p[0].length);
        }
        return ret;
    }

    public static boolean[][] clone(boolean[][] p) {
        boolean[][] ret = new boolean[p.length][p[0].length];
        int nr = p.length;
        for (int i = 0; i < nr; i++) {
            System.arraycopy(p[i], 0, ret[i], 0, p[0].length);
        }
        return ret;
    }

    public static String[][] clone(String[][] p) {
        String[][] ret = new String[p.length][p[0].length];
        int nr = p.length;
        for (int i = 0; i < nr; i++) {
            System.arraycopy(p[i], 0, ret[i], 0, p[0].length);
        }
        return ret;
    }
}

Related

  1. clone(boolean[] in)
  2. clone(byte[] input)
  3. clone(byte[] orig)
  4. clone(byte[][] im)
  5. clone(double[] array)
  6. clone(double[][] source)
  7. clone(final byte[] array)
  8. clone(final double[][] array)
  9. clone(final int[] original)