Here you can find the source of max(final int... numbers)
public static int max(final int... numbers)
//package com.java2s; /*//from w ww .j a v a2s . co m * GeoTools - The Open Source Java GIS Toolkit * http://geotools.org * * (C) 2007-2008, Open Source Geospatial Foundation (OSGeo) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ public class Main { /** * @return the largest of the given numbers */ public static int max(final int... numbers) { if (numbers.length == 0) { throw new IllegalArgumentException("at least one parameter is required"); } int max = numbers[0]; for (int i = 1; i < numbers.length; i++) { int number = numbers[i]; if (number > max) { max = number; } } return max; } }