Java Array Max Value arrayMax(double maxVal, double[] vals)

Here you can find the source of arrayMax(double maxVal, double[] vals)

Description

Applies a max value to all elements in an array

License

Open Source License

Parameter

Parameter Description
values a parameter

Declaration

public static double[] arrayMax(double maxVal, double[] vals) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//from   w  w  w.j  a  v  a  2 s. co  m
     * Applies a max value to all elements in an array 
     * @param values
     * @return
     */
    public static double[] arrayMax(double maxVal, double[] vals) {
        double[] out = new double[vals.length];
        for (int i = 0; i < vals.length; i++) {
            out[i] = Math.max(maxVal, vals[i]);
        }

        return out;
    }
}

Related

  1. argMax(int[] a)
  2. argmax(int[] a)
  3. argmax(int[] array)
  4. argmax(int[] array)
  5. argmax(int[] input)
  6. arrayMax(double[] arr)
  7. arrayMax(double[] x)
  8. arrayMax(final int[] array)
  9. arrayMax(int[] property)