Java Array Max Value max(int[] x, int length)

Here you can find the source of max(int[] x, int length)

Description

max

License

BSD License

Declaration

public static int max(int[] x, int length) 

Method Source Code

//package com.java2s;
//License from project: BSD License 

public class Main {
    public static int max(int[] x, int length) {
        int m = Integer.MIN_VALUE;
        for (int i = 0; i < length; i++)
            if (x[i] > m)
                m = x[i];//from  w w w  .j a  va  2s .  co m
        return m;
    }

    public static int max(int[] x) {
        return max(x, x.length);
    }

    public static double max(double[] x, int length) {
        double m = Double.NEGATIVE_INFINITY;
        for (int i = 0; i < length; i++)
            if (x[i] > m)
                m = x[i];
        return m;
    }
}

Related

  1. max(int[] values)
  2. max(int[] values)
  3. max(int[] values)
  4. max(int[] values)
  5. max(int[] vs)
  6. max(Long john, Long... jane)
  7. max(long[] array)
  8. max(long[] array)
  9. max(long[] array)