I've got the following scenario:
There are three ("pseudo" randomly chosen) int or float values which represent indices of an array. Now I'd like to compare the appropriate values from that array. After having compared them I'd like to know the middle value of the three and use this specific element for some further array operations.
The question is, what is the fastest way of finding the middle of the three within Java? My idea was this kind of pattern - as there are three numbers there are 6 possible permutations. Obviously, there is some ugly overhead and the flow of control isn't really that clearly laid out...
if (array[randomIndexA] >= array[randomIndexB] &&
array[randomIndexB] >= array[randomIndexC])
It would be really nice, if someone could help me out with a better and faster way of doing this. Even a plain logical form with clauses would be a nice thing...
Have a nice weekend anyway :D