Java Array Max Value max(int[] arr)

Here you can find the source of max(int[] arr)

Description

max

License

Open Source License

Declaration

public static int max(int[] arr) 

Method Source Code

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

public class Main {

    public static int max(int[] arr) {
        int maxIndex = 0;
        int maxValue = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (maxValue < arr[i]) {
                maxIndex = i;// ww w  .  ja  v a 2  s  .  co  m
                maxValue = arr[i];
            }
        }
        return maxIndex;
    }
}

Related

  1. max(int... xs)
  2. max(int[] a)
  3. max(int[] a)
  4. max(int[] arr)
  5. max(int[] arr)
  6. max(int[] arr)
  7. max(int[] arr, int count)
  8. max(int[] array)
  9. max(int[] array)