Make a copy for a 2D array

@param nums
@return
340350
public static int[][] copyOf(final int[][] nums) {
        final int[][] copy = new int[nums.length][];

        for (int i = 0; i < copy.length; i++) {
            final int[] member = new int[nums[i].length];
            System.arraycopy(nums[i], 0, member, 0, nums[i].length);
            copy[i] = member;
        }

        return copy;
    }
560441
public static short[] copyOf(short[] shortArray) {

    	short[] copy = new short[shortArray.length];
        System.arraycopy(shortArray, 0, copy, 0, shortArray.length);
        return copy;
    }
367170
public static Basic2DMatrix from1DArray(int rows, int columns, double[] array) {
        double[][] array2D = new double[rows][columns];

        for (int i = 0; i < rows; i++) {
            System.arraycopy(array, i * columns, array2D[i], 0, columns);
        }

        return new Basic2DMatrix(array2D);
    }
841534
private void copyArrays() {
        String[] oldSyms = mSymbols;
        int size = oldSyms.length;
        mSymbols = new String[size];
        System.arraycopy(oldSyms, 0, mSymbols, 0, size);
        Bucket[] oldBuckets = mBuckets;
        size = oldBuckets.length;
        mBuckets = new Bucket[size];
        System.arraycopy(oldBuckets, 0, mBuckets, 0, size);
    }
479852
public ExampleSet copy() {
        ExampleSet copy = new VectorSet();
        for (int i = 0; i < size(); i++)
            copy.add(x(i), y(i), id(i));

        return copy;
    }
383786
public static long[] concatArrays(List<long[]> arrays, int start, int size) {
		long[] result = new long[size];

		// How many values we still need to move over
		int howManyLeft = size;

		// Where in the resulting array we're currently bulk-writing
		int targetPosition = 0;

		// Where we're copying *from*, in (one of) the source array.
		// Typically 0, except maybe for the first array in the list
		int from = start;

		for (int i = 0; i < arrays.size() && howManyLeft > 0; i++) {
			long[] current = arrays.get(i);

			// Can't copy more than the current source array size, or the grand total pointer
			int howManyThisRound = Math.min(current.length - from, howManyLeft);
			System.arraycopy(current, from, result, targetPosition, howManyThisRound);
			from = 0;
			howManyLeft -= howManyThisRound;
			targetPosition += howManyThisRound;
		}

		// If this is non-zero here, means we were asked to copy more than what we were provided
		if (howManyLeft > 0) {
			throw new ArrayIndexOutOfBoundsException(
					String.format("Not enough data, short of %d elements", howManyLeft));
		}
		return result;
	}
945520
public static byte[] copyToBytes(MemorySegment[] segments, int offset, byte[] bytes,
			int bytesOffset, int numBytes) {
		if (inFirstSegment(segments, offset, numBytes)) {
			segments[0].get(offset, bytes, bytesOffset, numBytes);
		} else {
			copyMultiSegmentsToBytes(segments, offset, bytes, bytesOffset, numBytes);
		}
		return bytes;
	}
864712
public static double[][] copy(final double[][] m1) {
    final int rowdim = m1.length, coldim = getColumnDimensionality(m1);
    final double[][] X = new double[rowdim][coldim];
    for(int i = 0; i < rowdim; i++) {
      System.arraycopy(m1[i], 0, X[i], 0, coldim);
    }
    return X;
  }
141520
public static Object[] copyArray(Object[] array, int from, int to) {
    Object[] result = new Object[to - from];
    System.arraycopy(array, from, result, 0, to - from);
    return result;
  }
1090695
function copyOntoArray(a1, a2) {
  for (let i = 0; i < a2.length; i++) {
    a1[i] = a2[i];
  }
  a1.length = a2.length;
  return a1;
}
729841
private static double[] numberListToDoubleArray(List<Number> listOfNumbers) {
		double[] arrayOfDoubles	= new double[listOfNumbers.size()];
		for(int i=0; i<arrayOfDoubles.length; i++) {
			arrayOfDoubles[i] = listOfNumbers.get(i).doubleValue();
		}
		return arrayOfDoubles;
	}
733081
public static SparseTensor fromUnorderedKeyValuesNoCopy(int[] dimensionNumbers,
      int[] dimensionSizes, long[] keyNums, double[] values) {
    ArrayUtils.sortKeyValuePairs(keyNums, values, 0, keyNums.length);
    return new SparseTensor(dimensionNumbers, dimensionSizes, keyNums, values);
  }
237041
public static byte[] copyToBytes(MemorySegment[] segments, int offset, int numBytes) {
		return copyToBytes(segments, offset, new byte[numBytes], 0, numBytes);
	}
339708
public short[] toShortArray() {
    short[] copy = new short[size];
    for (int i = 0; i < size; i++) {
      copy[i] = elements[i];
    }
    return copy;
  }
498671
public static <E> ImmutableList<E> copyOf(E[] elements) {
    switch (elements.length) {
      case 0:
        return ImmutableList.of();
      case 1:
        return new SingletonImmutableList<E>(elements[0]);
      default:
        return new RegularImmutableList<E>(checkElementsNotNull(elements.clone()));
    }
  }
439547
public static double sumOfProducts(double[]... nums) {
        if (nums == null || nums.length < 1)
            return 0;
        double sum = 0;

        for (int i = 0; i < nums.length; i++) {
            /* The ith column for all of the rows */
            double[] column = column(i, nums);
            sum += times(column);

        }
        return sum;
    }
850971
public static byte[] copy(byte[] array, int from, int to) {
        if(to - from < 0) {
            return new byte[0];
        } else {
            byte[] a = new byte[to - from];
            System.arraycopy(array, from, a, 0, to - from);
            return a;
        }
    }