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

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

Description

max

License

Apache License

Return

The maximum of a and b.

Declaration

public final static long max(long a, long b) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /** @return The maximum of a and b. */
    public final static long max(long a, long b) {
        return a > b ? a : b;
    }/*from   w w w.  java 2 s.  c  o  m*/

    /** @return The maximum of a, b and c. */
    public final static long max(long a, long b, long c) {
        return max(a, max(b, c));
    }

    /** @return The maximum of a and b. */
    public final static int max(int a, int b) {
        return a > b ? a : b;
    }

    /** @return The maximum of a, b and c. */
    public final static int max(int a, int b, int c) {
        return max(a, max(b, c));
    }

    /** @return The maximum of the array a. */
    public final static int max(int[] a) {
        int result = Integer.MIN_VALUE;
        for (int i = 0; i < a.length; i++)
            if (a[i] > result)
                result = a[i];
        return result;
    }

    /** @return The maximum of the array a. */
    public final static double max(double[] a) {
        double result = Double.MIN_VALUE;
        for (int i = 0; i < a.length; i++)
            if (a[i] > result)
                result = a[i];
        return result;
    }
}

Related

  1. max(int x, int x2, int x3)
  2. max(int x, int y)
  3. max(Integer a, Integer b)
  4. max(Integer i1, Integer i2)
  5. max(Iterable nums)
  6. max(Number a, Number b)
  7. max(Number n0, Number n1)
  8. max(Number num1, Number num2)
  9. Max(Object in)