You should use an array and take a look at Arrays.sort(). This is one way of doing it, if-else and ternary are no good. If this is an assignment then you should look to deliver code that will work for any number of values even if your assignment works only with five numbers, the same algorithm should work with any amount.
Arrays (Java 2 Platform SE 5.0)