I have a variable type float.I wanted to print it upto 3 precision of decimal including trailing zeros.
Example :
2.5 >> 2.500
1.2 >> 1.200
1.3782 >> 1.378
2 >> 2.000
I am trying it by using
DecimalFormat _numberFormat= new DecimalFormat("#0.000");
Float.parseFloat(_numberFormat.format(2.5))
But it is not converting 2.5 >> 2.500.
Am I doing something wrong..
Please help..