public class MaxMin{
public static void main(String args[]){
int a[]={1,10,3,300,5};
MaxMin m = new MaxMin();
m.max(a[]);
m.min(a[]);
}
public void max(int i[]){
int j=0;
for(j=0;j<i.length;j++){
int s;
if(i[j]<i[j+1]){
s=i[j+1];
}else
s=i[j];
System.out.println(s);
}
}
public void min(int i[]){
int j=0;
for(j=0;j<i.length;j++){
int s;
if(i[j]>i[j+1]){
s=i[j+1];
}else
s=i[j];
System.out.println(s);
}
}
}