Results 1 to 5 of 5
- 04-08-2009, 06:37 PM #1
[SOLVED] Decimal Places - Is this possible?
my program uses
So I have 1 decimal place, however I have another calculation within my program that I want to calculate to 2 decimal places.Java Code:DecimalFormat bodymass = new DecimalFormat("#0.0");
Is this possible?Java Code:DecimalFormat bodymass = new DecimalFormat("#0.00");
-
I would use two separate DecimalFormat variables here, then use whichever one is needed at the time of its need. YMMV.
- 04-08-2009, 07:10 PM #3
I just forgot to change the variable in the code posted
well thethis is in the main body of the programJava Code:DecimalFormat bodymass = new DecimalFormat("#0.0");
the second decimal I want within
but i want it to be to 2 placesJava Code:private void cmdConvertActionPerformed(java.awt.event.ActionEvent evt) {
So it is possible?Java Code:DecimalFormat measurement = new DecimalFormat("#0.0");
-
It should work and if it doesn't it likely has nothing to do with using different decimal formatters. Have you tried it? What happens when you do?
- 04-08-2009, 07:49 PM #5
Similar Threads
-
round to two decimal places
By javaMike in forum New To JavaReplies: 3Last Post: 12-24-2011, 02:01 AM -
rounding double to two decimal places
By javaMike in forum Advanced JavaReplies: 15Last Post: 03-10-2010, 12:04 AM -
How to display an int or a double with two decimal places
By mcollins in forum New To JavaReplies: 4Last Post: 03-03-2009, 12:43 PM -
numbers with two decimal places
By little_polarbear in forum New To JavaReplies: 8Last Post: 08-27-2008, 11:04 PM -
Capping decimal places
By Rageagainst20 in forum New To JavaReplies: 1Last Post: 12-20-2007, 09:28 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks