Java Array Absolute Value absMax(double[] arr)

Here you can find the source of absMax(double[] arr)

Description

find absolute max value in array

License

Open Source License

Parameter

Parameter Description
arr a parameter

Declaration

public static double absMax(double[] arr) 

Method Source Code

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

public class Main {
    /**/*from   ww w  .  ja va  2s  . co m*/
     * find absolute max value in array
     *
     * @param arr
     * @return
     */
    public static double absMax(double[] arr) {
        double max = Math.abs(arr[0]);

        for (int i = 0; i < arr.length; i++) {
            double val = Math.abs(arr[i]);

            if (val > max) {
                max = val;
            }
        }

        return max;
    }
}

Related

  1. abs_sum(int[] data)
  2. absAvg(double[] inputArray, int divisions, int cap)
  3. absDiff(Double[] a, Double[] b)
  4. absMax(double x, double y)
  5. absMax(double[] data)
  6. absMax(double[] vector)
  7. absMean(double[] arr)
  8. absMean(double[] x)