Since you are calling

`findMax`

recursively as the last thing in the function, this is "tail recursion". And tail recursion can be replaced with a loop around the **entire**function body. If you do this it should become more apparent what is wrong. (I know you said you must use recursion. This is just an exercise in analyzing the behavior of your code.)

Java

public static double findMax(double[] numbers, int count){ do { double max = numbers[0]; double current= numbers[count-1]; if (count-1 == 0) { // why not if (count == 1) ?? return max; } else{ if (current > max){ max = current; } // return findMax(numbers,count-1); count = count - 1; } } while (true); }

Hint #2: What is happening to the variable

`max`

each time?
—SA

Event with recursion, this is a pretty easy exercise, but with no practical sense and is not efficient. If it is your assignment at programming class, you really need to solve the problem by yourself.

You should remember that in Java variables are passed by value.

—SA