aspose file tools
The moose likes Beginning Java and the fly likes Re: Roundup Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Re: Roundup Problem" Watch "Re: Roundup Problem" New topic

Re: Roundup Problem

Joe Cheung
Ranch Hand

Joined: Oct 18, 2002
Posts: 104
Dear all,

I have 2 double values, 2.44 and 2.45 that I want to make a roundup with them such that it can produre "2.4" and "2.5" respectively. Does any Java API provide methods for this?


David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
java.lang.Math has a method you can use, but you'll need to do some trickery to get it to round to different precisions (one decimal place in you case). Give it a try and post again if you can't figure out a way to work it.
tue march

Joined: Mar 09, 2005
Posts: 16

i think u have round()in java.lang.math class to solve it.

Good guy
I agree. Here's the link:
subject: Re: Roundup Problem