Can't solve last two requirements, technically I feel like it should not matter which number gets displayed for the 4th requirement. Not sure what I am missing
package com.codegym.task.task04.task0441;
/*
Somehow average
*/
import java.io.*;
import java.util.Arrays;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(reader.readLine());
int b = Integer.parseInt(reader.readLine());
int c = Integer.parseInt(reader.readLine());
int [] array = {a, b, c};
Arrays.sort(array);
System.out.println(array[1]);
if ((a == b) && (b == c) && (a == c)){
System.out.println(a);
}
else if ((a == b) || (b == c) || (a == c)){
System.out.println(b);
}
}
}