If you read through the code that you wrote you will see that your code isn't in line with the pseudo code I provided but, i guess it satisfies the requirement that the method return the max value for an array. But the way that you are going about it you are modifying the contents of the input array.
Code
class Main
{
public static int max(int[] array, int index) {
if(index==array.length-1) {
return array[index];
} else if(array[index]>array[index+1]) {
array[index+1]=array[index];
}
return max(array,index+1);
}
public static void main (String[] args)
{
int [] myArray = {1,3,2,4,5,1};
System.out.println ("--- Initial Values ---");
int j = 0;
for(int i : myArray){
System.out.println("Element: " + j + ", Value: " + i);
j++;
}
System.out.println ("--- Max Value ---");
System.out.println (max(myArray,0));
System.out.println ("--- Final Values ---");
j = 0;
for(int i : myArray){
System.out.println("Element: " + j + ", Value: " + i);
j++;
}
}
}
--- Initial Values ---
Element: 0, Value: 1
Element: 1, Value: 3
Element: 2, Value: 2
Element: 3, Value: 4
Element: 4, Value: 5
Element: 5, Value: 1
--- Max Value ---
5
--- Final Values ---
Element: 0, Value: 1
Element: 1, Value: 3
Element: 2, Value: 3
Element: 3, Value: 4
Element: 4, Value: 5
Element: 5, Value: 5
Notice the difference in the values before and after max() is invoked.