I\'m trying to copy the contents of my int array into an array of type double. Do I have to cast them first?
I successfully copied an array of type int to another a
You can iterate through each element of the source and add them to the destination array. You don't need an explicit cast going from int to double because double is wider.
int[] ints = {1, 2, 3, 4};
double[] doubles = new double[ints.length];
for(int i=0; i
You can make a utility method like this -
public static double[] copyFromIntArray(int[] source) {
double[] dest = new double[source.length];
for(int i=0; i