Java Array Max Value findMax(int[] v)

Here you can find the source of findMax(int[] v)

Description

Find the greatest value from an array of integer

License

Open Source License

Parameter

Parameter Description
v Array concerned

Return

Greatest value

Declaration

public static int findMax(int[] v) 

Method Source Code

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

public class Main {
    /**/*from   ww  w  .  j  a va2 s. com*/
     * Find the greatest value from an array of integer
     * @param v Array concerned
     * @return Greatest value
     */
    public static int findMax(int[] v) {
        int max = Integer.MIN_VALUE;
        for (int i = 0; i < v.length; ++i) {
            if (v[i] > max) {
                max = v[i];
            }
        }
        return max;
    }
}

Related

  1. findMax(double[] u, int startU, int length)
  2. findMax(double[] u, int startU, int length)
  3. findMax(double[] values)
  4. findMax(int a, int b, int c, int d)
  5. findMax(int[] array)
  6. findMax(int[] workArray, int idx)
  7. findMax(T[] arr)
  8. findMax2(int[] workArray, int idx, int max)
  9. findMaxAbs(float[] array)