While loop stop at first false condition
<p>I have this <code>while</code> loop:</p>

<pre><code>//All of this code is inside a for loop
positionUp = i - 1;

while ((positionUp &gt; 0) &amp;&amp; boardMatrix[positionUp][j] == boardMatrix[i][j]) {

    //do something

    positionUp--;
}
</code></pre>

<p>At some point, it is possible that <code>positionUp</code> it's assigned with the value <code>-1</code> (when <code>i=0</code>)</p>

<p>I thought that the <code>while</code>loop will stop at the first <code>false</code>evaluation thus not evaluating <code>boardMatrix[positionUp][j]</code> and not getting <code>java.lang.ArrayIndexOutOfBoundsException: -1</code></p>

<p>I'm not seeing how can I solve this. Can someone point me in the way?</p>
