Converting ArrayList<Double> to Double Array and visa-versa for JAVA/Android
<p>I've been trying to convert a Double ArrayList to a Double Array and visa-versa.</p>

<p>This is the code I have for converting Double ArrayList to Double Array, but the program keeps on crashing.
Am I missing something? or is the logic wrong all together?</p>

<pre><code>ArrayList&lt;Double&gt; numsy = new ArrayList&lt;Double&gt;();
ArrayList&lt;Double&gt; numsx = new ArrayList&lt;Double&gt;();  
for (int j = 0; j &lt; 100; j++) {
    numsy.add((double)generator.nextFloat());
    numsx.add((double)j);
}
double[] arrayX = new double[numsx.size()];     
double[] arrayY = new double[numsy.size()];
//assigns array x and y the values in the list.
for (int k1 = 0; k1 &lt; numsy.size(); i++) {
    double f = numsy.get(k1);
    arrayY[k1] = f;
    f = numsx.get(k1);
    arrayX[k1] = f;
}
FFT doFFT = new FFT(4);
doFFT.fft(arrayX, arrayY);
//adding the FFT numbers back to the Lists
for (int j = 0; j &lt; 100; j++) {
    numsy.add(arrayY[j]);
    numsx.add(arrayX[j]);
}
</code></pre>
