Java tutorial
//package com.java2s; public class Main { static public int max(int a, int b) { return (a > b) ? a : b; } static public int max(int[] values) { if (values.length < 2) throw new IndexOutOfBoundsException(); int max = values[0]; for (int i = 1; i < values.length; i++) if (values[i] > max) max = values[i]; return max; } }