A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Joined: Feb 09, 2003
Jan 13, 2004 23:46:00
I have a double value which prints a lot of digits after the decimal.
how do i control the number of digits after the decimal.
author and iconoclast
Joined: Jul 08, 2003
Jan 14, 2004 00:12:00
You can use the
class to prepare formatted Strings from your double value -- i.e.,
DecimalFormat df = new DecimalFormat("0.000"); System.out.println(df.format(123.456789));
prints 123.456 .
[Jess in Action]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Double Value
Convert double (primitive) value to String
How to count the number of digits after decimal point in java?
How to identify double length
Multiplying double values
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015