In java, how do I increase the index of two array(list)s of different sizes at the same time?
<p>I have two ArrayLists in java that have different sizes. ArrayLists 'probs' and 'theDoubles' (sizes 4 and 5 respectively). Array 'dprobs' (Double[5]) is just an Array that copies the values of 'theDoubles'.</p>

<p>Only those items that do not have zero-length (see '.size() > 0') are allowed to be added. One of them is zero-length, and gets replaced by a '0.0' double (added to the 'theDoubles' ArrayList).</p>

<p>My problem is that I do not know how to get this desired output:</p>

<pre><code>i=1 j=0
i=2 j=1
i=3 j=2
i=4 j=3
    j=4
</code></pre>

<p>I get this instead:</p>

<pre><code>i=1 j=1
i=2 j=2
i=3 j=3
i=4 j=4
</code></pre>

<p>Here is my code:</p>

<pre><code>        for (int i = 0; i &lt; 5; i++) {
            if (probs.get(i).size() &gt; 0) {
                System.out.println("i: " + i);
                System.out.println("j: " + j);

                theDoubles.add(Double.parseDouble(probs.get(i).get(0).getValue()));
                dprobs[j] = theDoubles.get(j);
            } else {
                theDoubles.add(0.0);
            }
            j++;
        }
        return dprobs;
</code></pre>

<p>I need to display this ('probs' ArrayList contents):</p>

<pre><code>0.0
0.0049522
0.0020487
0.0013568
0.0015332
</code></pre>

<p>and I am only getting this:</p>

<pre><code>0.0049522
0.0020487
0.0013568
0.0015332
</code></pre>

<p>because 'j' starts at '1' (it ignores the first item, which is '0.0' at index 0).</p>

<p>Any ideas?</p>

<p>Thanks</p>
