Results 1 to 2 of 2
Thread: Simple Java Methods Help...
- 01-29-2011, 07:00 PM #1
Member
- Join Date
- Jan 2011
- Posts
- 2
- Rep Power
- 0
Simple Java Methods Help...
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;
else
return intlog2(n/2);
}
- 01-29-2011, 10:56 PM #2
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Similar Threads
-
Trouble with static methods and boolean equals() methods with classes
By dreamingofgreen in forum New To JavaReplies: 8Last Post: 04-16-2012, 11:00 PM -
Static Builder and Create Methods for simple class
By Pilot Ace in forum New To JavaReplies: 3Last Post: 08-30-2009, 10:18 AM -
Need help with java methods
By dumas64 in forum NetworkingReplies: 1Last Post: 08-08-2009, 06:28 PM -
JSP functions and Java Bean methods
By lisa.lipsky in forum JavaServer Pages (JSP) and JSTLReplies: 4Last Post: 07-07-2009, 07:29 AM -
Methods of the java.util.Vector
By ajeeb in forum New To JavaReplies: 3Last Post: 12-26-2008, 03:01 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks