Java Array Max Value max(double values[], int size)

Here you can find the source of max(double values[], int size)

Description

max

License

Apache License

Declaration

public final static double max(double values[], int size) 

Method Source Code

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

public class Main {

    public final static double max(double values[], int size) {
        if (values == null || size == 0) {
            return Double.NaN;
        }//  w w  w . jav a2  s. c o  m

        double r = Double.NEGATIVE_INFINITY;
        for (int i = 0; i < size; i++) {
            double v = values[i];
            if (!Double.isNaN(v) && r < v) {
                r = v;
            }
        }
        return r == Double.NEGATIVE_INFINITY ? Double.NaN : r;
    }
}

Related

  1. max(byte[] lArray, byte[] rArray)
  2. max(byte[] values)
  3. max(D... comparables)
  4. max(double array[], int start, int length)
  5. max(double values[])
  6. max(double... a)
  7. max(double... arr)
  8. max(double... ds)
  9. max(double... ds)