Is their a better way to write this code? : <p>I know that this code does what I need it to do for my assignment but I can't help but feel like there is a much more...refined way to get the same results. Note that the last few outputs should only display if there have been at least 1 number(s) that are greater or less than 0</p>

<pre><code>//This program will take an unspecified number of 
//integers, determine how many of those integers are
//positive and how many are negative, and finally
//compute the total and average of the integers.


import java.util.Scanner;

public class exampleWork {

public static void main(String[] args) {
    //create a scanner
    Scanner input = new Scanner(System.in);

    //create a variable to hold the positive integers
    int pos = 0;

    //create a variable to hold the negative integers
    int neg = 0;

    //create a variable to hold the total number of entries
    int total = 0;

    //create a variable to hold the average
    float avg = 0; 

    //create a counter variable
    int count = 0;

  //prompt user to enter integer
   System.out.println("Enter an integer, the input ends if it is 0: ");
    int usrInput = input.nextInt();

        //determine if the number is positive, negative,
        //or zero, and either place in relative variables,
        //or end the loop.
    if (usrInput == 0)
        System.out.print("Only zero was entered");

    while (usrInput != 0) {

            if (usrInput &gt; 0){
            pos++;
            total += usrInput;
            count++;
            System.out.println("Enter an integer, the input ends if it is 0: ");
            usrInput = input.nextInt();


          } if (usrInput &lt; 0){
            neg++;
            total += usrInput;
            count++;
            System.out.println("Enter an integer, the input ends if it is 0: ");
            usrInput = input.nextInt();


           }

        }
    if (count &gt; 0){
    avg = (total / count);
    System.out.println("The number of positives is " + pos);
    System.out.println("The number of negatives is " + neg);
    System.out.println("The total is " + total);
    System.out.println("The average is " + avg);
    }   
</code></pre>

<p>}</p>

<p>}</p>
