A simple question is what is the fastest way to copy an array of doublings in Java. I am currently doing this ...
public static double[] clone_doubles(double[] from) { double[] to = new double[from.length]; for (int i = 0; i < from.length; i++) to[i] = from[i]; return to; }
which also performs the selection to avoid overflow, but if there is a faster way, I separate the selection from the copy.
I looked at Arrays.copyOf()
and System.arraycopy()
, but I'm wondering if anyone has any neat tricks.
Edit: How about copying double[][]
?
Simon source share