public class Solution { public static void main(String[] args) throws Exception { int maximum = 0; BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); while(true ){ String n1 = reader.readLine(); if (n1 != null) { int a = Integer.parseInt(n1); if(a>0){ maximum = maximum<a? a : maximum; } } else{break;} } if(maximum>0){ System.out.println(maximum); } //在此编写你的代码 } }