Here you can find the source of max(float... a)
public static float max(float... a)
//package com.java2s; //License from project: Apache License public class Main { public static float max(float... a) { switch (a.length) { case 0:// w w w . java 2 s. c om return Float.NaN; case 1: return a[0]; case 2: return Math.max(a[0], a[1]); case 3: return Math.max(a[0], Math.max(a[1], a[2])); case 4: return Math.max(Math.max(a[0], a[1]), Math.max(a[2], a[3])); default: { float m = a[0]; for (int i = 1; i < a.length; i++) { if (a[i] > m) m = a[i]; } return m; } } } }