int tal; int max = 0; int min = 0; while(tal != 0){ tal = scan.nextInt(); if(tal > max) { max = tal; } else if(tal < min) { } }