Here you can find the source of max(int[] t)
Parameter | Description |
---|---|
t | All number to compare |
public static int max(int[] t)
//package com.java2s; /*//from www. j a v a 2s . co m * PackJacket - GUI frontend to IzPack to make Java-based installers * Copyright (C) 2008 - 2009 Amandeep Grewal, Manodasan Wignarajah * * PackJacket is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * PackJacket 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with PackJacket. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Figure out maximum number in array. * @param t All number to compare * @return Highest number */ public static int max(int[] t) { // start with the first value int maximum = t[0]; for (int i = 1; i < t.length; i++) if (t[i] > maximum) // new maximum maximum = t[i]; return maximum; } }