-
Rounding a value
Hi,
Let say I hava a value 245.678909. I want to display it as 245.68. It is a double value. What should I do?
Thank you.
-
Make a java.text.DecimalFormat like:
static DecimalFormat df=new DecimalFormat("0.00");
use it like
System.out.println(df.format(aDoubleValue));
It will do the rounding for you.
Last edited by sjalle; 08-14-2005 at 07:16 PM.
eschew obfuscation
Similar Threads
-
By Zafar in forum Database
Replies: 2
Last Post: 09-27-2006, 07:29 PM
-
Replies: 1
Last Post: 07-14-2005, 08:17 AM
-
By Big Swifty in forum Java
Replies: 3
Last Post: 11-10-2002, 06:33 AM
-
By Teddy in forum VB Classic
Replies: 0
Last Post: 02-14-2002, 11:14 AM
-
By Wayne Hou in forum Web
Replies: 0
Last Post: 01-29-2001, 09:41 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks