Java Utililty Methods Number Max Value

List of utility methods to do Number Max Value

Description

The list of methods to do Number Max Value are organized into topic(s).

Method

Integermax(Iterable nums)
max
Integer result = null;
for (Integer num : nums) {
    if (result == null || num > result) {
        result = num;
return result;
longmax(long a, long b)
max
return a > b ? a : b;
Numbermax(Number a, Number b)
Returns the greater of the two given numbers.
return (a.doubleValue() > b.doubleValue()) ? a : b;
Numbermax(Number n0, Number n1)
Returns the maximum (double) of the given values.

If either value is null, then the other value will be returned.
if (n0 == null) {
    return n1;
if (n1 == null) {
    return n0;
double d0 = n0.doubleValue();
double d1 = n1.doubleValue();
...
Numbermax(Number num1, Number num2)
max
return (num1.doubleValue() > num2.doubleValue()) ? num1 : num2;
charMax(Object in)
Max
char out = 0;
if (in == null)
    return 0;
if (in instanceof char[]) {
    char[] inn = (char[]) in;
    for (int i = 0, s = inn.length; i < s; i++)
        out = Max(out, inn[i]);
    return out;
...
Numbermax(Object o1, Object o2)
max
Number n1 = getValue(o1);
Number n2 = getValue(o2);
if (n1 == null)
    return n2;
if (n2 == null)
    return n1;
if (n1.doubleValue() > n2.doubleValue())
    return n1;
...
Stringmax(String a, String b)
max
if (a == null && b == null) {
    return null;
if (a != null && b == null) {
    return a;
if (b != null && a == null) {
    return b;
...
Stringmax(String content, int max, String dotDotDot)
max
if (content == null)
    return null;
if (content.length() <= max)
    return content;
return content.substring(0, max) + dotDotDot;
Stringmax(String left, String right)
max
return left.compareTo(right) < 0 ? right : left;