Java Array Max Value max(double... elems)

Here you can find the source of max(double... elems)

Description

max

License

Open Source License

Declaration

static double max(double... elems) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    static double max(double... elems) {

        if (elems.length == 0)
            return 0;

        double best = elems[0];

        for (double t : elems) {
            if (t > best) {
                best = t;/*from   www. ja v  a  2 s  .  c  o m*/
            }
        }

        return best;

    }

    static int max(int... elems) {

        if (elems.length == 0)
            return 0;

        int best = elems[0];

        for (int t : elems) {
            if (t > best) {
                best = t;
            }
        }

        return best;

    }
}

Related

  1. max(double values[], int size)
  2. max(double... a)
  3. max(double... arr)
  4. max(double... ds)
  5. max(double... ds)
  6. max(double... nums)
  7. max(double... values)
  8. max(double... values)
  9. max(double... values)