int[] arr={1,2,43,45,6,96,2};
int max=-1;
int min=-1;
for
(
int
i =
0
; i < arr.length; i++) {
int
temp = arr
[i];
if
(i ==
0
) {
max = temp;
min = temp;
}
if
(temp > max) {
max = temp;
}
if
(temp < min) {
min = temp;
}
System.out.println("min is"+min);
System.out.println("max is"+max);
}