My program shows the greatest number from console. But don't pass test. I checked all possible variants, if there is -1, -2, -3, or 0 my program don't show nothing as in conditions. maybe i don't understand something?
package com.codegym.task.task05.task0532;
import java.io.*;
import java.util.Scanner;
/*
Task about algorithms
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int maximum = Integer.parseInt(reader.readLine());
if (maximum >0){
String aS="0";
String aSS="0";
int a;
int k = 0;
int b;
int c = 1;
while(aS!=null){
aS = reader.readLine();
b = (aS!=null)?Integer.parseInt(aS):2;
if(b<=0)
c = 0;
aSS = aS;
aSS = aSS!=null?aSS:"0";
a = Integer.parseInt(aSS);
maximum = maximum>a?maximum:a;
k++;
}
//write your code here
if(c>0)
System.out.println(maximum);
}
}
}