 <p>you can use the overloaded method of toArray() .. like this -</p> <pre><code>double[][] remainingStockout = new double[array.length][array.length]; stockout.toArray(remainingStockout); </code></pre>