• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Re: Roundup Problem

 
Joe Cheung
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thanks!
Joe
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

Thanks,
Good guy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic