Python For Loop Syntax to Java
<pre><code> for j in [c for c in coinValueList if c &lt;= cents]:
</code></pre>

<p>How would you write this for loop out in java?
Is it</p>

<pre><code>for(j=0, j &lt;= cents, j++){
    for(c=0; c&lt;= cents, j++){
</code></pre>

<p>I'm not sure what c and j are supposed to be compared to.
CoinValueList = {1,5,10,25}
cents = 0 -- it's in its own for loop before these two.</p>

<p>Let's decompose:</p>

<pre><code>array = [c for c in coinValueList if c &lt;= cents] # produces an array of coins from coinValueList that are &lt;= cents
for j in array: # iterates over array
    #stuff
</code></pre>

<p>So we can do that in only one loop, and the java equivalent would be:</p>

<pre><code>for(int j=0; j&lt;coinValueList.length; j++) {
    if(coinValueList[j] &lt;= cents) {
        #stuff
    }
}
</code></pre>

java python for-loop syntax