| Author |
Rounding a float value upto 2 decimal places
|
Lucky Chawla
Greenhorn
Joined: Aug 08, 2006
Posts: 22
|
|
Hi there, I want to display a float vlue with 2 decimal places I trid using : DecimalFormat df = new DecimalFormat("###.##"); df.format(l_tot_link); but still get the same result like 12.1666 aor 1234.5099087 , I wnt to display it as 12.16 and 1234.50 .can anybody help me out with this
|
 |
Luciano Mantuaneli
Greenhorn
Joined: Dec 04, 2006
Posts: 13
|
|
Although you don't posted how you try to print your result, I can guess you made it like this: If you done something like that, you will have in your console the 12.1666 value indeed. You have to know that the format method don't modify the parameter. Try something like this:
|
[]'s<br />Mantu<br /> <br />Sorry for my poor english...<br /> <br /><i>Time after time we lose sight of the way. Our causes cant see their effects</i> - Neil Peart
|
 |
Lucky Chawla
Greenhorn
Joined: Aug 08, 2006
Posts: 22
|
|
yes i did a small mistake..but now it is working for me.. Thanks Lucky
|
 |
 |
|
|
subject: Rounding a float value upto 2 decimal places
|
|
|