Finding maximum number from a loop
<p>I am trying to find maximum number from a loop and it's number of occurrences. Here is the code I have written so far.</p>

<pre><code>public class MaxNumbers {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int max = 0;
        int number = 0;
        int count_max = 0;
        while (true) {
             number = input.nextInt();
            if (number == 0) {
                break;
            }
            number = max;
            if (max &gt; number) {
                max=number;
                count_max++;
            }

        }
        System.out.println("Max Number: " + number);
        System.out.println("Occurences: " + count_max);
    } 
</code></pre>

<p>I getting only zero in the output, any logical error I am making?</p>
