Java Array Max Value findMaxAbs(float[] array)

Here you can find the source of findMaxAbs(float[] array)

Description

Finds maximal abs element in array

License

Open Source License

Parameter

Parameter Description
array array

Return

Minimum Value

Declaration

public static float findMaxAbs(float[] array) 

Method Source Code

//package com.java2s;
/*//  w  w  w  .ja va 2  s .c o m
 * Copyright (c) 2008-2013 Maksim Khadkevich and Fondazione Bruno Kessler.
 *
 * This file is part of MART.
 * MART is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2, as published
 * by the Free Software Foundation.
 *
 * MART is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with MART; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

public class Main {
    /**
     * Finds maximal abs element in array
     *
     * @param array array
     * @return Minimum Value
     */
    public static float findMaxAbs(float[] array) {
        float max = 0;
        for (int i = 0; i < array.length; i++) {
            if (Math.abs(array[i]) > max) {
                max = array[i];
            }
        }
        return max;
    }
}

Related

  1. findMax(int[] array)
  2. findMax(int[] v)
  3. findMax(int[] workArray, int idx)
  4. findMax(T[] arr)
  5. findMax2(int[] workArray, int idx, int max)
  6. findMaxCommonPrefix(String path1, String path2)
  7. findMaxDiff(byte[] rand, byte[] newRand)
  8. findMaximumUnitFor(long elapsed, int specifiedMax)
  9. findMaxIndex(final int[] array)