How do you find a maximum or minimum double from a set?
<p>In a basic java program, I've defined two methods of a class that are supposed to return the maximum and minimum numbers from a set of four doubles. The value parameter is taken in from a for loop, and then compared to the standing min or max parameter. However, the outputs are not correct and I cannot seem to find out why; I know I have made a logic error somewhere.</p>

<p>The two methods-</p>

<pre><code>//calculate the minimum 
public double calcMin(double value, double min)
{
    if (min &lt; value)
   {
       min = value;
   }
   return value;
}

//calculate the maximum
public double calcMax(double value, double max)
{
    if (max &lt; value)
    {
        max = value;
    }
    return max;
}
</code></pre>

<p>The for loop-</p>

<pre><code>    for (int i = 0; i &lt; fillups.length; i ++)
    {
        distance[i] = fillups[i].calcDistance();
        milesPerGallon[i] = fillups[i].calcMPG(distance[i]);
        cost[i] = fillups[i].calcTotalCost();
        minimum = fillups[i].calcMin(distance[i], minimum);
        maximum = fillups[i].calcMax(distance[i], maximum);
        minMPG = fillups[i].calcMin(milesPerGallon[i], minMPG);
        maxMPG = fillups[i].calcMax(milesPerGallon[i], maxMPG);
        minPrice = fillups[i].calcMin(price[i], minPrice);
        maxPrice = fillups[i].calcMax(price[i], maxPrice);
        fillups[i].printResults(i, day[i], distance[i], cost[i], milesPerGallon[i]);  
    } 
</code></pre>

<p>The calcMax method seems to work, but the calcMin does not. Perhaps there is a way to make them work using the Double.MAX_VALUE and Double.MIN_VALUE constants.</p>