I want to be able to calculate the largest value in a list of numbers
I want the type of number to be any number (it should work with double, int, long, etc)
The method that I tried to create for this is not working and keeps returning the first value of the array
public static <V extends Number & Comparable<V>> V max(final V... numbers) { V currentLargest = numbers[0]; for (V value : numbers) { int arraySize = 0; if (currentLargest.compareTo(numbers[arraySize]) < 0) { currentLargest = numbers[arraySize]; } arraySize = arraySize + 1; } return currentLargest; } I dont know what I am doing wrong