Hey guys, how do you find the max value and min value of an ArrayList without using collections? I know this is the way you find the max and min value of an array but I don't get how you would do it for an ArrayList.
//highest value int[] numbers = new int[50]; int highest = numbers[0]; for (int i = 1; i < numbers.length; i++) { if (numbers[i] > highest) highest = numbers[i]; } //lowest value int lowest = numbers[0]; for (int i = 1; i < numbers.length; i++) { if (numbers[i] < lowest) lowest = numbers[i]; }