Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

decimal place

How do i make a double number(eg value 5) to be display as
5.00 on the screen?
Thanks
[104 byte] By [racerrunner] at [2007-11-11 6:48:49]
# 1 Re: decimal place
double num = 3.1416
DecimalFormat df = new DecimalFormat("0.00");

String a = df.format(num);
Phaelax at 2007-11-11 22:40:18 >
# 2 Re: decimal place
http://www.java2s.com/ExampleCode/Development-Class/Formatanumbertocurrency.htm

a complete demo
yinpeng263 at 2007-11-11 22:41:13 >
# 3 Re: decimal place
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=33&t=015587

-----
Naveen Vooka
www.devsquare.com
DevSquare - Online Application Development
NaveenVooka at 2007-11-11 22:42:11 >