title: How do I check if a number is bigger than all other numbers to the right of it in array
body: <p>For example I have an array of these values</p>
  
  <blockquote>
    <p>[10, 14, 2, 1, 5, 7, 8, 0]</p>
  </blockquote>
  
  <p>If I start with 10 it would be bigger than 2, 1, 5, 7, 8, and 0. Then 14 would be bigger than 2, 1, 5, 7, 8, and 0 and so on.</p>
  
  <p>Is there a way I can loop through a certain array and find the total count of smaller numbers moving from left to right?</p>
  
  <p>Here is what I have tried:</p>
  
  <pre class="lang-java prettyprint-override"><code>for(int i = 0; i &lt; array.length; i++) {
      for(int j = i + 1; j &lt; array.length; j++) {
          if(array[i] &gt; array[j]) {
              count++;
      }
  }
  </code></pre>
  
  <p>Using</p>
  
  <blockquote>
    <p>[10, 14, 2, 1, 5, 7, 8, 0]</p>
  </blockquote>
  
  <p>I expect the output of <code>18</code>, but the actual output is <code>1</code>.</p>