title: Boolean explanation
body: <p>I want to make a method which checks if an array is sorted, with the smallest integer in the beginning of the array and the largest at the end. I named the array sequence.</p>
  
  <pre><code>public boolean isSorted(){
     int i = 1;
     while(i &lt; sequence.length &amp;&amp; sequence[i] &gt;= sequence[i-1]){
        i++;
     }
     return i &gt;= sequence.length;
  }
  </code></pre>
  
  <p>I got to this code with the help of a friend, however I don't entirely understand it. What is returned as a boolean? As far as I could understand, reading on other posts, it will return true <em>only</em> when i >= sequence.length.
  Given the conditions by while, i will be bigger or the same as sequence.length only when the array is sorted.</p>
  
  <p>Am I correct? Sorry if my formatting is terrible, I'm still new to stackoverflow.</p>