Java Array Max Value max(int[] values)

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

Description

max

License

Open Source License

Declaration

public static int max(int[] values) 

Method Source Code

//package com.java2s;

public class Main {
    public static int max(int[] values) {
        int max = Integer.MIN_VALUE;
        for (int i = 0; i < values.length; i++) {
            if (values[i] > max) {
                max = values[i];//from   w ww  .  jav  a  2 s  . c o  m
            }
        }
        return max;
    }

    public static int max(int[][] values) {
        int max = Integer.MIN_VALUE;
        for (int i = 0; i < values.length; i++) {
            for (int j = 0; j < values[i].length; j++) {
                if (values[i][j] > max) {
                    max = values[i][j];
                }
            }
        }
        return max;
    }
}

Related

  1. max(int[] in, int x1, int x2)
  2. max(int[] list)
  3. max(int[] nums)
  4. max(int[] t)
  5. max(int[] vals, int max)
  6. max(int[] values)
  7. max(int[] values)
  8. max(int[] values)
  9. max(int[] values)