My Solution works fine but it is not meeting the last condition. Any idea, why?
package com.codegym.task.task05.task0532;
import java.io.*;
/*
Task about algorithms
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int maximum=0;
int n = 0;
//write your code here
String strInput = reader.readLine();
if (strInput != null){
maximum = Integer.parseInt(strInput);
}
while(true){
strInput = reader.readLine();
if (strInput == null){
break;
}
else{
n = Integer.parseInt(strInput);
if ( n > maximum){
maximum = n;
}
}
}
System.out.println(maximum);
}
}