在Java中,如何将双精度转换为百分比



我有一个叫做平均值的二重。如果它的输出是0.8266666531562805,我如何格式化它以显示为82.67%

当前线路:

System.out.println("Your score is: " + average);
DecimalFormat df = new DecimalFormat("#.##%");
df.format(0.8266666531562805);

最新更新