I have no idea what why java tells me that I had a Format Bug. Please help.
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:542)
at java.lang.Integer.parseInt(Integer.java:615)
at com.codegym.task.task05.task0532.Solution.main(Solution.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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 i = 1;
while ( i > 0)
{
int a = Integer.parseInt(reader.readLine()) ;
if (a <= 0)
{
i = -100;
break;
}
maximum = maximum > a ? maximum:a;
}
//write your code here
System.out.println(maximum);
}
}