i have this program.. basically it keeps reading an integer until the user inputs 0... then it outputs the count of positives and negatives, the sum of the postives and the negatives, largest values and lowest value..

basically everything is working all except the maximum negative value...

it always prints out 0 as an output.... could any1 help me? im a newbie so sorry for the shitty code.

import java.util.Scanner; import java.io.*; public class lab31 { public static void Numbers (String [] args) { Scanner input=new Scanner (System.in); int sumnegatives = 0; int sumpositives = 0; int negatives = 0; int positives = 0; int number; int max = 0; int min = 0; int max2 = 0; int min2 = 0; System.out.println("Arithmetic Fun"); System.out.println("Please enter series of numbers(to terminate enter 0)"); System.out.print("Enter an integer: "); number=input.nextInt(); if(number>0){ max=number; min=number; } if(number<0){ max2=number; min2=number; } while (number != 0){ if (number > 0) { positives++; sumpositives += number; if (number>max) max=number; if(number<min) min=number; } else if (number < 0){ negatives++; sumnegatives += number; if(number>max2) max2=number; if (number<min2) min2=number; } System.out.print("Enter an integer: "); number=input.nextInt(); }//while loop System.out.println("\nStatistics for positive values"); System.out.println("\nCount of positive numbers : " + positives); System.out.println("Sum of positive numbers : " + sumpositives); System.out.println("Maximum positive numbers : " + max); System.out.println("Minumum positive numbers : " + min); System.out.println("\nStatistics for negative values"); System.out.println("\nCount of negative numbers: " + negatives); System.out.println("Sum of negative numbers : " + sumnegatives); System.out.println("Maximum negative number : " + max2); System.out.println("Minumum negative number : " + min2); } }