goja-core/src/main/java/goja/core/kits/MoneyKit.java
public MoneyKit[] allocate(int targets) {
        MoneyKit[] results = new MoneyKit[targets];

        MoneyKit lowResult = newMoneyWithSameCurrency(cent / targets);
        MoneyKit highResult = newMoneyWithSameCurrency(lowResult.cent + 1);

        int remainder = (int) cent % targets;

        for (int i = 0; i < remainder; i++) {
            results[i] = highResult;
        }

        for (int i = remainder; i < targets; i++) {
            results[i] = lowResult;
        }

        return results;
    }
public MoneyKit[] allocate(int targets) {
        MoneyKit[] results = new MoneyKit[targets];

        MoneyKit lowResult = newMoneyWithSameCurrency(cent / targets);
        MoneyKit highResult = newMoneyWithSameCurrency(lowResult.cent + 1);

        int remainder = (int) cent % targets;

        for (int i = 0; i < remainder; i++) {
            results[i] = highResult;
        }

        for (int i = remainder; i < targets; i++) {
            results[i] = lowResult;
        }

        return results;
    }
public MoneyKit [ ] allocate ( int targets ) { MoneyKit [ ] results = new MoneyKit [ targets ] ; MoneyKit lowResult = newMoneyWithSameCurrency ( cent / targets ) ; MoneyKit highResult = newMoneyWithSameCurrency ( lowResult . cent + 1 ) ; int remainder = ( int ) cent % targets ; for ( int i = 0 ; i < remainder ; i ++ ) { results [ i ] = highResult ; } for ( int i = remainder ; i < targets ; i ++ ) { results [ i ] = lowResult ; } return results ; }
货币分配。 <p/> <p/> 将本货币对象尽可能平均分配成<code>targets</code>份。 如果不能平均分配尽，则将零头放到开始的若干份中。分配
运算能够确保不会丢失金额零头。

@param targets 待分配的份数
@return 货币对象数组，数组的长度与分配份数相同，数组元素 从大到小排列，所有货币对象的金额最多只相差1分。
货币分配。 <p / > <p / > 将本货币对象尽可能平均分配成<code > targets< / code > 份。 如果不能平均分配尽，则将零头放到开始的若干份中。分配 运算能够确保不会丢失金额零头。