Find the max of 3 numbers in Java with different data types

Solution 1:

Math.max only takes two arguments. If you want the maximum of three, use Math.max(MY_INT1, Math.max(MY_INT2, MY_DOUBLE2)).

Solution 2:

If possible, use NumberUtils in Apache Commons Lang - plenty of great utilities there.

https://commons.apache.org/proper/commons-lang/javadocs/api-3.1/org/apache/commons/lang3/math/NumberUtils.html#max(int[])

NumberUtils.max(int[])