这个问题在这里已有答案:
如果我有{“myparam”:12.8}并且我的请求类有 整数myparam; myparam设置为12而不是13。 为什么它是一个楼层而不是四舍五入?
这是从Double请求int值的预期行为(如Double API中所示):
public abstract int intValue()
Returns the value of the specified number as an int. This may involve
rounding or truncation.
Returns:
the numeric value represented by this object after conversion to type int.
解释它的最简单方法 - 从double获取int时,包括'。'在内的所有权利。被切碎了。