adding n number of zeros after decimal

前端 未结 3 381
猫巷女王i
猫巷女王i 2020-12-20 02:06

I need to give accuracy of a number entered by user till few digit. like if user enter some random value and gives that he wants accuracy till three digit then I need to rou

3条回答
  •  猫巷女王i
    2020-12-20 02:36

    you can use string format:

    Double area = 6

    String ar = String.format("%.3f", area); ar = 6.000

提交回复
热议问题