【发布时间】:2012-11-30 16:28:44
【问题描述】:
我正在使用这个:
int newWidth = Math.round(297 * (40 / 414));
在代码中,数字实际上是变量,但它们是它们所持有的,当我运行代码时,newWidth 返回为 0,而我期待的是 28 或 29。我看不出有什么问题这里...
【问题讨论】:
-
40 / 414 等于 0
-
在网上搜索“integer arithmetic”。