public static Number max(final Number a, final Number b) {
        // handle one or both null (propagate null if both)
        if (a == null || b == null)
            return a == null ? b : a;

        // handle one or both NaN (propagate NaN if both)
        if (eitherAreNaN(a, b))
            return isNaN(a) ? b : a;

        final Class<? extends Number> clazz = getHighestCommonNumberClass(a, b);
        return getHelper(clazz).max.apply(a, b);
    }
Gets the larger number of the two provided returning the highest common number class between them.

<pre>
    a = 4, b = 2 -> 4
    a = null, b = 1 -> 1
    a = 1, b = null -> 1
    a = null, b = null -> null
    a = NaN, b = 1 -> 1
    a = 1, b = NaN -> 1
    a = NaN, b = NaN -> NaN
</pre>
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/NumberHelper.java