public class VarArgsExample {
    public static void main(String[] args) {
        System.out.println(max(20, 3));
        System.out.println(max(1, 6, 20));
        System.out.println(max(2, 1, 3, -2, -20, 1));
    }
    
    static int max(int firstnumber, int... numbers) {
        int max = firstnumber;
        
        for (int i = 0; i < numbers.length; i++) {
            if (numbers[i] > max) {
                max = numbers[i];
            }
        }
        
        return max;
    }
}