Simple question, what's the fastest way of copying an array of doubles in Java. I currently do 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 does the allocation to avoid overflows, but if there is a quicker way I will separate the allocation from the copy.
I have looked at Arrays.copyOf() and System.arraycopy() but I'm wondering if anyone has any neat tricks.
Edit:
How about copying a double[][]?
 
     
     
     
     
     
    