I want to print 6.5
to 6.05
. And 6.12
to 6.12
.
How it could be achieved using java utilities?
I tried DecimalFormat
as below:
DecimalFormat df = new DecimalFormat("##.0#");
System.out.println("sam --------- " + df.format(6.5));
But not working. Any help on this?