Java Number Max Value max(final NUMBER_TYPE number1, final NUMBER_TYPE number2)

Here you can find the source of max(final NUMBER_TYPE number1, final NUMBER_TYPE number2)

Description

max

License

Open Source License

Declaration

public static <NUMBER_TYPE extends Number> NUMBER_TYPE max(final NUMBER_TYPE number1,
            final NUMBER_TYPE number2) 

Method Source Code

//package com.java2s;

public class Main {
    public static <NUMBER_TYPE extends Number> NUMBER_TYPE max(final NUMBER_TYPE number1,
            final NUMBER_TYPE number2) {
        if (number1 == null && number2 == null) {
            return null;
        } else if (number1 == null) {
            return number2;
        } else if (number2 == null) {
            return number1;
        } else if (number1.doubleValue() > number2.doubleValue()) {
            return number1;
        } else {/*from   w  w w  .j a  v a 2s.  co m*/
            return number2;
        }
    }
}

Related

  1. max(final int a, final int b)
  2. max(final int a, final int b)
  3. max(final Iterable numbers)
  4. max(final Iterable values)
  5. max(final NUMBER_TYPE n1, final NUMBER_TYPE n2)
  6. max(final String string1, final String string2)
  7. Max(float a, float b)
  8. max(float a, float b)
  9. max(float a, float b)