开发者

Rounding vs truncation in Math class in Java

At present I am doing this:

long x = Math.round((numberFormat(Collections.min(te开发者_如何学运维mpList)) * 1000) / 1000);

In the above statement tempList is List type. Suppose Collections.min(tempList) returns the value 236.589; x is assigned the value 237, but I want 236 only.

How do I do that?


Use the floor-method instead of round.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜