Пробовал разными способами, закомментировал разные варианты, которые пробовал. Всё равно ошибка валидации с отрицательными числами
package com.javarush.task.task04.task0419;
/*
Максимум четырех чисел
*/
import java.io.*;
import java.lang.*;
public class Solution {
public static void main(String[] args) throws Exception {
//напишите тут ваш код
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
//считывание числа а
String sA = reader.readLine();
int a = Integer.parseInt(sA);
String sB = reader.readLine();
int b = Integer.parseInt(sB);
String sC = reader.readLine();
int c = Integer.parseInt(sB);
String sD = reader.readLine();
int d = Integer.parseInt(sB);
System.out.println(max2(max2(a,b),max2(c,d)));
//System.out.println(Math.max((Math.max(a,b)),(Math.max(c,d))));
//System.out.println(Math.max((Math.max(Math.abs(a),Math.abs(b))),(Math.max(Math.abs(c),Math.abs(d)))));
}
public static int max2 (int a1, int a2){
if (a1 >= a2)
{
return (a1);
}
else {
return (a2);
}
}
}
/* int e = Math.max(a,b);
int f = Math.max(c,d);
if ( e >= f )
{
System.out.println(e);
}
else
{
System.out.println(f);
}
*/
/*
if (a >= b)
{
if (a >= c)
{
if (a >= d) {
System.out.println(a);
}
else {
System.out.println(d);
}
}
else {
if (c >= d ) {
System.out.println(c);
}
else {
System.out.println(d);
}
}
}
else {
if (b >= c) {
if (b >= d) {
System.out.println(b);
}
else {
System.out.println(d);
}
}
else {
if (c >= d) {
System.out.println(c);
}
else {
System.out.println(d);
}
}
}
*/