Java Array Min Value min(final double[] vector)

Here you can find the source of min(final double[] vector)

Description

min

License

Open Source License

Declaration

public static double min(final double[] vector) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2015 Vienna University of Technology.
 * 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 w  w.ja v  a  2s. c o  m
 * Martin Fleck (Vienna University of Technology) - initial API and implementation
 *
 * Initially developed in the context of ARTIST EU project www.artist-project.eu
 *******************************************************************************/

public class Main {
    public static double min(final double[] vector) {
        if (vector.length == 0) {
            throw new RuntimeException("Input vector is empty.");
        }

        double min = vector[0];
        for (final double value : vector) {
            if (min > value) {
                min = value;
            }
        }
        return min;
    }
}

Related

  1. Min(final double[] input)
  2. min(final double[] nums)
  3. min(final double[] tab)
  4. min(final double[] target)
  5. min(final double[] vec)
  6. min(final float[] a, final float[] b)
  7. min(final int... array)
  8. min(final int... integers)
  9. min(final int... numbers)