Java exit while loop from called method : <p>How do I make this code exit after the s variable updates to 0? As of now, its executing the whole block outputting the last print statement before stopping. Is this the normal behaviour of while loop?</p>

<pre><code>public class test {

    private static int i = 0;
    private static int s = 1;
    public static void main(String[] args) {
        // TODO Auto-generated method stub

        s:
        while(s&gt;0 &amp;&amp; i==0) {
            s();
        }


    }
    public static void s() {
        System.out.println(s);
        s--;
        //I want the program to stop here since s is already 0.
        System.out.println(s);
    }

}
</code></pre>
