It's not a secret anymore!*
The moose likes Beginning Java and the fly likes incrementing to next ten value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "incrementing to next ten value" Watch "incrementing to next ten value" New topic
Author

incrementing to next ten value

steve kelly
Greenhorn

Joined: Feb 15, 2012
Posts: 25
I am sure there are a gazillion examples and a bunch of ways to do this. I was just finding something existing that does this. Basically, I want to increment to next 10 value no matter what the number is. Example if I have an int of 23 I want to return 30. If I have an int of 47 I want to return 50.
There has to be something out there does this already without playing with decimals and multiplying/rounding etc... right?
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 557
I recommend you write your own. Two lines, maybe one? Just think of the sense of accomplishment you'll have.


Learning Java using Eclipse on OpenSUSE 11.2
Linux user#: 501795
Edwin Torres
Ranch Hand

Joined: Mar 19, 2011
Posts: 37
Greg Brannon wrote:I recommend you write your own. Two lines, maybe one? Just think of the sense of accomplishment you'll have.

One:


Follow me: @CompGuyProbs
Read me: Freehold Computers Examiner
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 557
Or with the solution provided by Edwin, you don't need to.
Edwin Torres
Ranch Hand

Joined: Mar 19, 2011
Posts: 37
fred rosenberger wrote:Edwin,

Please refrain from providing solutions. We prefer to help guide people to finding their own, rather than simply spoon feeding it to them.

Got it. Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: incrementing to next ten value
 
Similar Threads
Java Math - Floor/Ceil returning double
How to set a time limit on a java function running a regex
returning a value from try and finally
problem understanding methods
send id from jsp to struts action