Answer:
see explaination
Step-by-step explanation:
MaxArray.java
public class MaxArray{
public static void main(String[] args) {
int a[] = {1,2,5,4,3};
int max = max (a, 5);
System.out.println("Max value is "+max);
}
public static int max (int a[],int size){
if (size > 0) {
return Math.max(a[size-1], max(a, size-1));
} else {
return a[0];
}
}
}
Output:
MaxArray