What part of my code is not scanning that would show that the maximum number displayed is the maximum number entered?

package com.codegym.task.task05.task0532;
import java.io.*;
import java.util.*;
/*
Task about algorithms
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
//write your code here
String input;
input = reader.readLine();
int N;
int maximum = 0;
ArrayList<Integer> numArray = new ArrayList<Integer>();
while(input != null) {
N = Integer.parseInt(input);
numArray.add(N);
if(N > maximum) {
maximum = N;
}
input = reader.readLine();
}
Collections.sort(numArray);
Collections.reverse(numArray);
for(int i = 0; i < numArray.size(); i++) {
if(numArray.get(i) > maximum) {
maximum = numArray.get(i);
}
}
if(maximum > 0) {
System.out.println(maximum);
}
// nextNum = Integer.parseInt(reader.readLine());
// int[] numArray = new int[0];
// ArrayList<Integer> numArray = new ArrayList<Integer>();
// // int spot = 0;
// while(input != null) {
// nextNum = Integer.parseInt(input);
// if(nextNum > 0) {
// numArray.add(nextNum);
// }
// // numArray[spot] = nextNum;
// // spot++;
// Collections.sort(numArray);
// Collections.reverse(numArray);
// input = reader.readLine();
// }
// for(int i = 0; i < numArray.size(); i++) {
// if(numArray.get(i) > maximum) {
// maximum = numArray.get(i);
// }
// }
}
}