title: What is the fastest way to copy a double[] in Java?
body: <p>Simple question, what's the fastest way of copying an array of doubles in Java.  I currently do this...</p>
  
  <pre><code>public static double[] clone_doubles(double[] from)
  {
      double[] to = new double[from.length];
      for (int i = 0; i &lt; from.length; i++) to[i] = from[i];
      return to;
  }
  </code></pre>
  
  <p>which also does the allocation to avoid overflows, but if there is a quicker way I will separate the allocation from the copy.</p>
  
  <p>I have looked at <code>Arrays.copyOf()</code> and <code>System.arraycopy()</code> but I'm wondering if anyone has any neat tricks.</p>
  
  <p><strong>Edit:</strong>
  How about copying a <code>double[][]</code>?</p>