java: formatting a result set into an array
<p>my java is rusty and I was wondering if someone could give me a code sample of how to do the following:</p>

<p>I have a result set from a database call that returns the following table:</p>

<p>object_id(int), marker_id(int), xpos(float), ypos(float)</p>

<p>the results are grouped by object_id such that you have something like this:<br>
<code>
1023, 19, 0.2, 0.8 <br>
1023, 63, 0.2, 0.9 <br>
1023, 63, 0.2, 0.9 <br>
1072, 63, 0.2, 0.23 <br>
1072, 63, 0.2, 0.9 <br>
1072, 63, 0.2, 0.6 <br>
1012, 63, 0.2, 0.6 <br>
1012, 63, 0.2, 0.6 
</code></p>

<p>I was looking for the most effective way of generating two 2d double arrays such that
the first has
<code>
double[][] array1 = { <br>
{0.2,0.8,0.2,0.9...},<br>
{0.2,0.8,0.2,0.9...},<br>
 ...} 
</code><br></p>

<p>each sub array contains the sequence x1,y1,x2,y2,x3,y3 for row1,row2,etc... for the corresponding object_id in the result set. </p>

<p>The second 2d array would contain: <br>
<code>
double[][] array2 = {<br>
{1.0},<br>
{0.9},<br>
{0.8},<br>
...<br>
{0.0}}
</code></p>

<p>Where there's an entry for each unique object_id and the first entry has 1.0 and the last entry has 0.0</p>

<p>The two arrays should have the same length since each entry represents an object_id</p>

<p>Hope that makes sense</p>

<p>Thanks</p>
