If you are happy with an array, you may use the Arrays.sort()
method:
double[] numbers = new double[] { num1, num2, num3 };
Arrays.sort(numbers);
System.out.println("The numbers are " + Arrays.toString(numbers));
Given input 1 3 2
this prints The numbers are [1.0, 2.0, 3.0]
.
solved Can’t sort 3 floating point numbers in Java