public static void main(String[] args) {
int[] arr = {10,20,30,90,50};
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
for(int x : arr){
if(x < min) min = x;
}
for(int x : arr){
if(x > max) max = x;
}