Все проверил вроде условия правильно сформулировано, но при введении последовательности a = 1, b = 1, c = 2 Программа выстраивает последовательность max = 2 midi = 2 min = 1. Не могу понять где ошибка.
package com.javarush.task.task04.task0420;
/*
Сортировка трех чисел
*/
import java.io.*;
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());
System.out.println(max(a, b, c) + " " + midl(a, b, c) + " " + min(a, b, c));
//напишите тут ваш код
}
private static int max(int a, int b, int c) {
if (a >= b && a >= c) return a;
else if (b >= a && b >= c) return b;
else return c;
}
private static int midl(int a, int b, int c) {
if (a >= b && b >= c) return b;
else if (b >= a && a >= c) return a;
else return c;
}
private static int min(int a, int b, int c) {
if (a >= b && c >= b) return b;
else if (b >= a && c >= a) return a;
else return c;
}
}