Java Number Min Value min(int a, int b)

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

Description

min

License

Apache License

Return

The minimum of a and b.

Declaration

public final static int min(int a, int b) 

Method Source Code

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

public class Main {
    /** @return The minimum of a and b.*/
    public final static int min(int a, int b) {
        return a < b ? a : b;
    }/*from w ww. j  a  v a 2 s .  c o  m*/

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

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

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

Related

  1. min(float dirOffset, float min, float max)
  2. min(float value1, float value2)
  3. min(float value1, float value2)
  4. min(float x0, float x1)
  5. min(int a, int b)
  6. min(int a, int b)
  7. min(int a, int b)
  8. min(int a, int b)
  9. min(int a, int b)