Here you can find the source of findMax(double newNumber, double currentMax)
Parameter | Description |
---|
public static double findMax(double newNumber, double currentMax)
//package com.java2s; //License from project: Open Source License public class Main { /**/*www .j ava 2 s . c o m*/ * Return the max between 2 numbers. If the * current max is initialized as NaN, it automatically * sets as max the new number. * @param newNumber, the number we are going to compare against the existing * max. * @param currentMax, the existing max, can be initialized as Double.NaN * if it doesn't exist yet. * @return the max between the 2 numbers. */ public static double findMax(double newNumber, double currentMax) { return Double.isNaN(currentMax) ? newNumber : currentMax > newNumber ? currentMax : newNumber; } }