Here you can find the source of copyArray(double[] array)
Parameter | Description |
---|---|
array | the array |
public static double[] copyArray(double[] array)
//package com.java2s; //License from project: Open Source License public class Main { /**// w ww. j a v a 2 s. c o m * Creates a copy of the given array. * @param array the array * @return the copy of the given array */ public static double[] copyArray(double[] array) { double[] retVal = new double[array.length]; System.arraycopy(array, 0, retVal, 0, array.length); return retVal; } /** * Creates a copy of the given array. * @param array the array * @return the copy of the given array */ public static int[] copyArray(int[] array) { int[] retVal = new int[array.length]; System.arraycopy(array, 0, retVal, 0, array.length); return retVal; } /** * Creates a copy of the given array. * @param array the array * @return the copy of the given array */ public static boolean[] copyArray(boolean[] array) { boolean[] retVal = new boolean[array.length]; System.arraycopy(array, 0, retVal, 0, array.length); return retVal; } /** * Creates a copy of a sub-array of the given array. * @param array the array * @param start the start index (inclusive) of the sub-array * @param length number of elements in the sub-array * @return copy of sub-array of the given array. */ public static double[] copyArray(double[] array, int start, int length) { double[] retVal = new double[length]; System.arraycopy(array, 0, retVal, start, length); return retVal; } /** * Creates a copy of a sub-array of the given array. * @param array the array * @param start the start index (inclusive) of the sub-array * @param length number of elements in the sub-array * @return copy of sub-array of the given array. */ public static int[] copyArray(int[] array, int start, int length) { int[] retVal = new int[length]; System.arraycopy(array, 0, retVal, start, length); return retVal; } /** * Creates a copy of a sub-array of the given array. * @param array the array * @param start the start index (inclusive) of the sub-array * @param length number of elements in the sub-array * @return copy of sub-array of the given array. */ public static boolean[] copyArray(boolean[] array, int start, int length) { boolean[] retVal = new boolean[length]; System.arraycopy(array, 0, retVal, start, length); return retVal; } }