import java.util.*; class G22 { static interface BinaryOperator<T> { T apply( T arg1, T arg2 ); } static class IntegerAddition implements BinaryOperator<Integer> { public Integer apply( Integer a, Integer b){ return a+b; } } static class IntegerMaximum implements BinaryOperator<Integer> { public Integer apply( Integer a, Integer b){ return a < b ? b : a; } } public static <T> T fold( Collection<T> list, T start, BinaryOperator<T> op ){ T result = start; for( T t: list ){ result = op.apply(result,t); } return result; } static class Maximum<T extends Comparable<? super T>> implements BinaryOperator<T> { public T apply( T a, T b){ return a.compareTo(b) < 0 ? b : a; } } public static <T extends Comparable<? super T>> T max( Collection<T> c ){ //public static <T extends Comparable<? super T>> T max( Collection<? extends T> c ){ return fold(c,c.iterator().next(),new Maximum<T>()); } public static void main( String[] args ){ System.out.println( max(fromArrayToList(args)) ); } public static <T> ArrayList<T> fromArrayToList( T[] a ){ ArrayList<T> list = new ArrayList<T>(a.length); for( T o: a ){ list.add(o); } return list; } }