谁能解释一下这段代码是什么意思?在 if/else 中。我已多次阅读文档,但无法理解这些功能的含义。谢谢。
private long getBalanceWithFactor(long balance, double factor) {
double faccountbalance = (double)balance * factor;
long res = 0;
if ((Math.ceil(faccountbalance) - faccountbalance) <= 0.5)
res = (long)Math.ceil(faccountbalance);
else
res = (long)Math.floor(faccountbalance);
return res;
}