Write a program in java that reads an unspecified number of integers, determines how many positive and negative values have been read, and computes the total and average of the input values (not counting zeros). Your program ends with the input 0. Display the average as a floating-point number.

import java.util.Scanner;

public class PositiveNegativeAverage {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

int total = 0;
int positiveCount = 0;
int negativeCount = 0;
int number;

System.out.println("Enter an unspecified number of integers (0 to exit):");

while (true) {
number = input.nextInt();

if (number == 0) {
break;
} else if (number < 0) {
negativeCount++;
} else if (number > 0) {
positiveCount++;
}

total += number;
}

if (positiveCount + negativeCount == 0) {
System.out.println("No values have been entered.");
} else {
double average = (double) total / (positiveCount + negativeCount);

System.out.println("Total: " + total);
System.out.println("Positive count: " + positiveCount);
System.out.println("Negative count: " + negativeCount);
System.out.println("Average: " + average);
}
}
}