Note to self
Code, cooking, catman
Thursday, February 09, 2006
A cool function
I wish i saw this when i had to do java homework, it would have helped.
to bad i never had to since reverse any numbers.
int getReverse(int i) {
int j = 0;
while (i != 0) {
j *= 10;
j += i % 10;
i /= 10;
}
return j;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment