Java Number Max Value max(int a, int b)

Here you can find the source of max(int a, int b)

Description

max

License

Apache License

Declaration

public static int max(int a, int b) 

Method Source Code

//package com.java2s;
/*//from   w w w  .java 2 s.co  m
 * Copyright (c) 2014. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

public class Main {
    private static long negativeZeroDoubleBits = Double.doubleToLongBits(-0.0d);

    public static int max(int a, int b) {
        return (a >= b) ? a : b;
    }

    public static double max(double a, double b) {
        if (a != a)
            return a; // a is NaN
        if ((a == 0.0d) && (b == 0.0d) && (Double.doubleToLongBits(a) == negativeZeroDoubleBits)) {
            return b;
        }
        return (a >= b) ? a : b;
    }
}

Related

  1. max(int a, int b)
  2. max(int a, int b)
  3. max(int a, int b)
  4. max(int a, int b)
  5. max(int a, int b)
  6. max(int a, int b, int c)
  7. max(int a, int b, int c)
  8. max(int a, int b, int c)
  9. max(int a, int b, int c)