Hi, I am working on a simple program where in one of the classes i have to add a static method which recursively divides a passed integer by 2 and returns a count of number of calls it takes to reach 1??I also have to Add a static method called "sumofcharacters" to my Recursion class that recursively sums the character values in a passed string and returns the sum. Can some one help me with how to return a count of number of calls and method that computes sums of the character values in a passed string...

this is what i have so far....

public static int intlog2(int n) {
if (n == 1)
return 1;
return intlog2(n/2);


simply make a loop and count the number of times the loop executes like this:

int count = 0;
while([B]varname[/B] != 1){
[B]varname[/B] = [B]varname[/B] / 2;
return count;

you can change the items in bold.

In order to add chars you need to convert them to int values.

char character1 = 'c';
int charValue1 = (int)character1;

then simply add them together.

hope this helps. ( ;
if any thing does not work please tell me I don't have access to a java development environment at the moment.