Here you can find the source of max(double... a)
Parameter | Description |
---|---|
The | vararg of doubles. |
public static double max(double... a)
//package com.java2s; /******************************************************************************* * Copyright (c) 2010-2015 BSI Business Systems Integration AG. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://from w ww .j ava 2 s . c o m * BSI Business Systems Integration AG - initial API and implementation ******************************************************************************/ public class Main { /** * Computes the maximum value of a vararg of doubles. * * @param The * vararg of doubles. * @return The maximum. Returns 0 if the parameter is null or the length of the vararg is 0. */ public static double max(double... a) { if (a == null) { return 0; } if (a.length == 0) { return 0; } double max = Double.MIN_VALUE; for (double d : a) { max = Math.max(max, d); } return max; } }