如何将双舍入返回到十分之一

时间:2014-04-08 17:19:44

标签: java rounding

我试图返回一个双倍,以便它向上舍入到十分之一。我有:

 roundedTemp = (double)Math.round(tempNum *10)/10;
 return roundedTemp;

我做错了什么?我把它恢复到小数点后两位......

1 个答案:

答案 0 :(得分:0)

使用DecimalFormat。

DecimalFormat df = new DecimalFormat("#.#");
相关问题