Search Results

Showing results 1 to 3 of 3
Search took 0.06 seconds.
Search: Posts Made By: Narue ; Forum: Java and child forums
Forum: Java Oct 13th, 2008
Replies: 11
Views: 1,380
Posted By Narue
>Is there a better way?
Yes, design the class hierarchy such that you don't need to know the dynamic type of the object. Perhaps some form of strategy pattern would clean up that selection code.
Forum: Java Oct 30th, 2004
Replies: 4
Views: 8,691
Posted By Narue
Calculating the least common multiple is trivial if you have a routine to find the greatest common divisor:

public int lcm ( int a, int b )
{
return a * b / gcd ( a, b );
}

You shouldn't...
Forum: Java Oct 29th, 2004
Replies: 4
Views: 8,691
Posted By Narue
>I got the method down here (for the first integer):
Why not write it generally for all integers?

public int reverse_integer ( int val )
{
int ret = 0;

while ( val != 0 ) {
ret = 10...
Showing results 1 to 3 of 3

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC