Here you can find the source of max(int... xs)
public static int max(int... xs)
//package com.java2s; //License from project: Open Source License public class Main { public static int max(int... xs) { if (xs.length == 0) throw new RuntimeException("ArrayHelper.max cannot be used on an empty array."); int v = Integer.MIN_VALUE; for (int x : xs) { if (x > v) v = x;//from ww w .j a v a2 s. c om } return v; } public static double max(double... xs) { if (xs.length == 0) throw new RuntimeException("ArrayHelper.max cannot be used on an empty array."); double v = Double.MIN_VALUE; for (double x : xs) { if (x > v) v = x; } return v; } }