import java.util.Scanner;
public class Egone {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter three integers");
int a = input.nextInt();
int b = input.nextInt();
int c = input.nextInt();
int one, two, three;
one = two = three = 0;
if (a > b && a > c) one = a;
else if (b > c && b > a) one = b;
else if (c > a && c > b) one = c;
// for second largest and third largest
if (one == a) {
if (b > c) {
two = b;
} else {
two = c;
}
if (two == b) {
three = c;
} else {
three = b;
}
}
if (one == b) {
if (a > c) {
two = a;
} else {
two = c;
}
if (two == a) {
three = c;
} else {
three = a;
}
}
if (one == c) {
if (a > b) {
two = a;
} else {
two = b;
}
if (two == a) {
three = b;
} else {
three = a;
}
}
System.out.println("Sorted order: " + one + " " + two + " " + three);
}
}
This is my code and I feel most of this code is redundant. I am not sure if it passes all test cases either. Anyone can help me minimize this code?