Rounding a value
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?
Make a java.text.DecimalFormat like:
static DecimalFormat df=new DecimalFormat("0.00");
use it like
It will do the rounding for you.
Last edited by sjalle; 08-14-2005 at 08:16 PM.
By Zafar in forum Database
Last Post: 09-27-2006, 08:29 PM
Last Post: 07-14-2005, 09:17 AM
By Big Swifty in forum Java
Last Post: 11-10-2002, 07:33 AM
By Teddy in forum VB Classic
Last Post: 02-14-2002, 12:14 PM
By Wayne Hou in forum Web
Last Post: 01-29-2001, 10:41 AM
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