Here is a tip for you.
http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html
float highTemp = Math.max(temp1, Math.max(temp2, temp3); // high
float lowTemp = Math.min(temp1, Math.min(temp2, temp3); // low
float middleTemp = (temp1 + temp2 + temp3) - highTemp - lowTemp; // middle
In this approach, there is no need to use if
, switch
, array
or to sort
.