Java tutorial
//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]; 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; } }