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

        long total = 0;

        for (long ratio : ratios) {
            total += ratio;
        }

        long remainder = cent;

        for (int i = 0; i < results.length; i++) {
            results[i] = newMoneyWithSameCurrency((cent * ratios[i]) / total);
            remainder -= results[i].cent;
        }

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

        return results;
    }
public MoneyKit[] allocate(long[] ratios) {
        MoneyKit[] results = new MoneyKit[ratios.length];

        long total = 0;

        for (long ratio : ratios) {
            total += ratio;
        }

        long remainder = cent;

        for (int i = 0; i < results.length; i++) {
            results[i] = newMoneyWithSameCurrency((cent * ratios[i]) / total);
            remainder -= results[i].cent;
        }

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

        return results;
    }
public MoneyKit [ ] allocate ( long [ ] ratios ) { MoneyKit [ ] results = new MoneyKit [ ratios . length ] ; long total = 0 ; for ( long ratio : ratios ) { total += ratio ; } long remainder = cent ; for ( int i = 0 ; i < results . length ; i ++ ) { results [ i ] = newMoneyWithSameCurrency ( ( cent * ratios [ i ] ) / total ) ; remainder -= results [ i ] . cent ; } for ( int i = 0 ; i < remainder ; i ++ ) { results [ i ] . cent ++ ; } return results ; }
货币分配。 <p/> <p/> 将本货币对象按照规定的比例分配成若干份。分配所剩的零头 从第一份开始顺序分配。分配运算确保不会丢失金额零头。

@param ratios 分配比例数组，每一个比例是一个长整型，代表 相对于总数的相对数。
@return 货币对象数组，数组的长度与分配比例数组的长度相同。
货币分配。 <p / > <p / > 将本货币对象按照规定的比例分配成若干份。分配所剩的零头 从第一份开始顺序分配。分配运算确保不会丢失金额零头。