Is there a way to prevent a DecimalFormat
object from automatically moving the decimal place two places to the right?
This code:
double d = 65.87;
DecimalFormat df1 = new DecimalFormat(" #,##0.00");
DecimalFormat df2 = new DecimalFormat(" #,##0.00 %");
System.out.println(df1.format(d));
System.out.println(df2.format(d));
produces:
65.87
6,587.00 %
But I'd like it to produce:
65.87
65.87 %