0

Array

How to find maximum and minimum value in an array in Java language.

9th Jan 2022, 7:27 PM
Muzammil Khan Tareen
Muzammil Khan Tareen - avatar
3 Respostas
+ 1
Tnx
10th Jan 2022, 3:03 AM
Muzammil Khan Tareen
Muzammil Khan Tareen - avatar
0
Try this function public static int max(int... array) { if (array.length == 0) { // ... } int max = array[0]; for (int a : array) { if (a > max) max = a; } return max; }
9th Jan 2022, 7:41 PM
Marco Ginato
Marco Ginato - avatar
0
Tnx
9th Jan 2022, 7:43 PM
Muzammil Khan Tareen
Muzammil Khan Tareen - avatar