Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes Dealing with decimal places 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 » Beginning Java
Reply Bookmark "Dealing with decimal places" Watch "Dealing with decimal places" New topic
Author

Dealing with decimal places

Azam Bukhari
Ranch Hand

Joined: Oct 03, 2000
Posts: 58
Dear Community,
if i want a decimal number i.e float or double display numbers only upto two three or whatever i choose the limit after decimal places..
Azam
sazam@email.com
=====================
Also
how does one become a Ranchhand, bartender, sherrif??

Don't wanna invent the wheel again!!
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
Take a look at the DecimalFormat class. The methods that you need to look at are:
applyPattern() - It will set the pattern of how you want the data to appear ie #,##0.00
format() - Which actually applies the pattern.
As far as your other question do a search in the Java Ranch forum. There are explanations on each of those. If you can't find them, just ask.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dealing with decimal places
 
Similar Threads
Retriving data with four decimal places
How to find number of decimal places?
BigInteger
SetPrecision?
Urgent A method in Java which rounds 18 places to 8 places after decimal