Java Number Min Value min(final NUMBER_TYPE number1, final NUMBER_TYPE number2)

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

Description

min

License

Open Source License

Declaration

public static <NUMBER_TYPE extends Number> NUMBER_TYPE min(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 min(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  ww w . ja  v a2 s.c  om*/
            return number2;
        }
    }
}

Related

  1. min(final float a, final float b, final float c)
  2. min(final int a, final int b)
  3. min(final int a, final int b)
  4. min(final Iterable numbers)
  5. min(final NUMBER_TYPE n1, final NUMBER_TYPE n2)
  6. min(final String string1, final String string2)
  7. min(float a, float b)
  8. min(float a, float b)
  9. min(float a, float b, float c, float d, float e)