mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
修复Money
中金额分配的问题bug(issue#IC9Y35@Gitee)
This commit is contained in:
@@ -19,6 +19,7 @@ package cn.hutool.v7.core.math;
|
|||||||
import cn.hutool.v7.core.text.StrUtil;
|
import cn.hutool.v7.core.text.StrUtil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
@@ -63,6 +64,7 @@ import java.util.Currency;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class Money implements Serializable, Comparable<Money> {
|
public class Money implements Serializable, Comparable<Money> {
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = -1004117971993390293L;
|
private static final long serialVersionUID = -1004117971993390293L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -742,7 +744,7 @@ public class Money implements Serializable, Comparable<Money> {
|
|||||||
final Money lowResult = newMoneyWithSameCurrency(cent / targets);
|
final Money lowResult = newMoneyWithSameCurrency(cent / targets);
|
||||||
final Money highResult = newMoneyWithSameCurrency(lowResult.cent + 1);
|
final Money highResult = newMoneyWithSameCurrency(lowResult.cent + 1);
|
||||||
|
|
||||||
final int remainder = (int) cent % targets;
|
final int remainder = (int) (cent % targets);
|
||||||
|
|
||||||
for (int i = 0; i < remainder; i++) {
|
for (int i = 0; i < remainder; i++) {
|
||||||
results[i] = highResult;
|
results[i] = highResult;
|
||||||
|
Reference in New Issue
Block a user