How get int[] array from column in rows of ResultSet?
<p>I am using the following way to put <code>int</code> values from a <code>ResultSet</code> into an int array. This seems very innefficient but I can't figure out how to get an array of primitive <code>int</code>'s where I don't know the size beforehand.</p>

<pre><code>List&lt;Integer&gt; ints = ArrayList&lt;Integer&gt;();

while ( results.next ) ints.add( results.getInt( "id" );

int[] intsArray = new int[ ints.size() ];
for ( int i = 0; i &lt; ints.length; i++ ) int[ i ] = ints.get( i ); //auto-boxes here
</code></pre>

<p>I need these to be a primitive array as that's what a method requires.</p>