java - Double formatter to append trailing 0 -
i using decimalformat
class format double
input required format.
decimalformat df = new decimalformat("#.00000000");
then, using df.format(/*some value*/)
.
the problem if pass double more 8 decimal part, formatting 8 decimal part required, if pass value less 8 decimal part, not appending trailing 0
's. how achieve that?
example
df.format(12.67543456667)
format 12.67543457
but,
df.format(12.675)
format 12.675
only.
how format 12.67500000
?
yep, add:
df.setminimumfractiondigits(8);
Comments
Post a Comment