Results 1 to 2 of 2
Thread: How to round a double?
- 05-31-2007, 03:49 PM #1
Member
- Join Date
- May 2007
- Posts
- 10
- Rep Power
- 0
- 05-31-2007, 03:50 PM #2
Member
- Join Date
- May 2007
- Posts
- 11
- Rep Power
- 0
You can use DecimalFormat class for printing.
Java Code:double x = 1.20136; DecimalFormat f = new DecimalFormat("#.##"); f.format(x);
Similar Threads
-
round to two decimal places
By javaMike in forum New To JavaReplies: 3Last Post: 12-24-2011, 02:01 AM -
Calculating sin of a double value
By Java Tip in forum Java TipReplies: 0Last Post: 01-13-2008, 08:13 PM -
transforming double to int
By AlejandroPenton in forum New To JavaReplies: 2Last Post: 12-11-2007, 01:34 AM -
Getting smallest possible Double value
By Java Tip in forum Java TipReplies: 0Last Post: 12-06-2007, 02:15 PM -
How to determine if the value of a JTextField is double
By nemo in forum New To JavaReplies: 1Last Post: 05-20-2007, 11:19 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks