JAVA "while" why does this code's result = 4949?
<p>I think this code's result=4950.
That's because 99+98+...1=4950.
Would you please teach me how.</p>

<pre><code>public static void main(String[] args) {
    int n = 100;
    int total = 0;
    while(n &gt;= 0){
        total += --n;
    }
    System.out.println(total);
}
</code></pre>
