I am passing all but the last condition. All of my test data that I have tried seems to work. Any ideas?
package com.codegym.task.task05.task0532;
import java.util.Scanner;
/*
Task about algorithms
*/
public class Solution {
public static void main(String[] args) throws Exception {
Scanner scanner = new Scanner (System.in);
boolean check = scanner.hasNextInt();
int maximum = 0;
int holder;
int count = 0;
while (check == true){
if (count == 0){
maximum = scanner.nextInt();
count++;
}
holder = scanner.nextInt();
maximum = maximum > holder ? maximum : holder;
check = scanner.hasNextInt();
}
System.out.println(maximum);
}
}