Question: Write a recursive method in java called getMax that takes an array of integers as a parameter. Return the largest integer in the array. Hint

Write a recursive method in java called getMax that takes an array of integers as a parameter. Return the largest integer in the array.
Hint
Use the static method Arrays.copyOfRange(array, start, stop) to create a smaller array.
start represents the starting index of the new array, and stop represents the ending element of the new array.
In addition, use the Math.max(int1, int2) method to return the larger of two integers.
Expected Output
If the getMax method is called with the array {1,2,3,4,5} then it would return 5
If the getMax method is called with the array {11,22,3,41,15} then it would return 41

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!