All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.allegro.finance.tradukisto.internal.support.NumberChunking Maven / Gradle / Ivy

Go to download

Small java library created to convert numbers to their word representations

There is a newer version: 3.1.0
Show newest version
package pl.allegro.finance.tradukisto.internal.support;

import java.util.LinkedList;
import java.util.List;

public class NumberChunking {

    static final int SPLIT_FACTOR = 1_000;

    public List chunk(Long value) {
        LinkedList result = new LinkedList<>();

        while (value > 0) {
            result.addFirst((int) (value % SPLIT_FACTOR));
            value /= SPLIT_FACTOR;
        }

        return result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy