Problem with fairly basic recursive method

The point of my code is to find the answer of logbn. I am stuck on the part where a is incremented. I'm not exactly sure where to increment it because every value input will return 1. Any advice? Thanks!

So here is my code.

/**

* Calculates base-b log of n recursively

* @param b the base of the logarithm to be found

* @param n the value whose logarithm is being found

* @return base b log of n

* Pre-Condition: n must be integer multiple of b

* @since Lesson 6-4

* @version 12-6-11

* @author TFLeGacY

*/

public int log(int b, int n)

{ int a = 0;

if(n / b == 1)

return 1;

else

{ log(b, n = n / b);

a++;

}

return a;

}

Re: Problem with fairly basic recursive method

Re: Problem with fairly basic recursive method

1) Do not bump your post...for a vast number of reasons it may even affect your chances of receiving help. 2) Do not post your same question twice. I am locking this thread.

http://www.javaprogrammingforums.com...-you-help.html