return Integer.valueOf(extEntity.getValue());
此时如果是0.0 转 就是失败。
return new BigDecimal(extEntity.getValue()).intValue();
解决
Java类型转换技巧
本文探讨了在Java中处理浮点数到整数的转换方法,提供了两种不同的解决方案:使用Integer.valueOf()和BigDecimal.intValue(),并指出在特定情况下后者更为可靠。
return Integer.valueOf(extEntity.getValue());
此时如果是0.0 转 就是失败。
return new BigDecimal(extEntity.getValue()).intValue();
解决
4933
1万+
715

被折叠的 条评论
为什么被折叠?