The Artima Developer Community
Sponsored Link

Java Answers Forum
How to round to the nearest .001

1 reply on 1 page. Most recent reply: Oct 10, 2002 9:39 AM by Don Hill

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
J

Posts: 3
Nickname: highheat
Registered: Oct, 2002

How to round to the nearest .001 Posted: Oct 9, 2002 12:42 PM
Reply to this message Reply
Advertisement
how do you do it without creating a new method? thanx, Jamie


Don Hill

Posts: 70
Nickname: ssswdon
Registered: Jul, 2002

Re: How to round to the nearest .001 Posted: Oct 10, 2002 9:39 AM
Reply to this message Reply
BigDecimal bg = new BigDecimal(1234.5678);
bg = bg.setScale(3, BigDecimal.ROUND_HALF_UP);
System.out.println (bg.doubleValue());

Hows That!

HTH
> how do you do it without creating a new method?
> thanx, Jamie

Flat View: This topic has 1 reply on 1 page
Topic: ejb on WebLogic Previous Topic   Next Topic Topic: i still get an error for if (charAt(index) == '-')

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use