Results 1 to 1 of 1
Thread: Dynamic DecimalFormatter
- 03-17-2008, 04:16 PM #1
Member
- Join Date
- Dec 2007
- Location
- Mumbai, India
- Posts
- 37
- Rep Power
- 0
Dynamic DecimalFormatter
Hi All,
Is there any way to dynamically format the decimal Number(double) without rounding in java. For Example i will pass a double value and numberof decimal places it has to format the value using comma seperated values.
public static String formatNumber(double number,int decimalPlaces)
{
java.text.DecimalFormat threeDecimalFormatter = new java.text.DecimalFormat("###,###,###,##0.000"); //using three decimal it can vary based on decimalPlaces
threeDecimalFormatter.format(number);
}
Please note that it should not round the value call of
roundNumber(123.4567,3) should return 123.456
Regards
Felix
Similar Threads
-
Dynamic Binding
By javarishi in forum New To JavaReplies: 3Last Post: 04-09-2008, 11:17 AM -
Help for dynamic classes
By Bender in forum Advanced JavaReplies: 1Last Post: 12-19-2007, 08:46 PM -
how to generate dynamic pdf
By valery in forum Advanced JavaReplies: 1Last Post: 08-06-2007, 10:01 PM -
problems with Dynamic Xml
By boy22 in forum XMLReplies: 1Last Post: 07-24-2007, 12:10 AM -
dynamic update in swt
By sandor in forum SWT / JFaceReplies: 0Last Post: 05-14-2007, 08:32 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks