aspose file tools
The moose likes Java in General and the fly likes restrict the decimal value Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "restrict the decimal value" Watch "restrict the decimal value" New topic
Author

restrict the decimal value

saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
i am displaying the result in decimal value.for that i wanna display only 2 numbers after the decimal how can i do that..

thanx in advance.
cinux


A = HARDWORK B = LUCK/FATE If C=(A+B) then C=SUCCESSFUL IN LIFE else C=FAILURE IN LIFE
SCJP 1.4
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24059
    
  13

Look at the java.text.DecimalFormat class.


[Jess in Action][AskingGoodQuestions]
Sivaraman Lakshmanan
Ranch Hand

Joined: Aug 02, 2003
Posts: 231
Hi,
If you just want to show 2 digits after decimal, use java.text.DecimalFormat.

Regards,
Sivaraman.L
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: restrict the decimal value
 
Similar Threads
How to find number of decimal places?
Correctly specified Identifiers
why the long value print 10 ,not 12 ?
Urgent A method in Java which rounds 18 places to 8 places after decimal
Decimals not converting to correct fractions