How fast algorithm can you write for finding out if an integer is a power of two?
Try google. It's great for helping with homework.
Posting code? Use code tags like this: [code]...Your code here...[/code]
Click here for examples of Java Code
Check out this page http://graphics.stanford.edu/~seander/bithacks.html
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.
- Brian W. Kernighan
To enhance your chance's of getting an answer be sure to read
and http://www.codeguru.com/forum/showthread.php?t=366302 before posting
Refresh your memory on formatting tags here
Get your free MS compiler here