Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.List;

public class Main {
    public static double[] minmax(List<Double> paramList) {
        if (paramList.size() == 0) {
            return new double[2];
        }
        double d1 = ((Double) paramList.get(0)).doubleValue();
        double d2 = d1;
        int i = paramList.size();
        for (int j = 1;; j++) {
            if (j >= i) {
                return new double[] { d1, d2 };
            }
            double d3 = ((Double) paramList.get(j)).doubleValue();
            d1 = Math.min(d1, d3);
            d2 = Math.max(d2, d3);
        }
    }
}