Does any know how i can calculate the minimum value of an array of Integers. Thank you for your help and have a happy new year
Printable View
Does any know how i can calculate the minimum value of an array of Integers. Thank you for your help and have a happy new year
Loop through the array and set the lowest to a variable.
Code:Integer[] array = new Integer[num];
// set array values here
int smallest;
for (int i = 1; i < array.length; i++) {
smallest = Math.min((int) array[i - 1], (int) array[i]);
}
System.out.println(smallest);