Первую часть отлично читает. Но, если все числа ровны, выдает два ответа.
package com.javarush.task.task04.task0419;
/*
Максимум четырех чисел
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String x1 = reader.readLine();
String x2 = reader.readLine();
String x3 = reader.readLine();
String x4 = reader.readLine();
int a = Integer.parseInt(x1);
int b = Integer.parseInt(x2);
int c = Integer.parseInt(x3);
int d = Integer.parseInt(x4);
int x = Math.max(a, b);
int y = Math.max(c, d);
int z = Math.max(x, y);
System.out.println(z);
if (a==b&&b==c&&c==d){
System.out.println(a);
}
}
}