The while on line 7 looks wrong to me. This is a recursive solution, it shouldn't need another loop. I would expect a simple if.
You'll probably want a better print on line 32, since array is an array.
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
At the entry to your recursive method print the values of all the parameters so we can see where its going wrong.
To print the contents of the array you can use
System.out.println( Arrays.toString(array));
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
Forget the computer. Get a sheet of paper and work out how you would do this by hand. In detail. Then, and only then, write a program that does the same thing.
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073