public static long toMemory()

in gflog-core/src/main/java/com/epam/deltix/gflog/core/util/PropertyUtil.java [103:128]


    public static long toMemory(final String value) {
        long multiplier = 1;
        int end = value.length();

        if (value.endsWith("K") || value.endsWith("k")) {
            multiplier = 1024;
            end = end - 1;
        } else if (value.endsWith("KB") || value.endsWith("kb")) {
            multiplier = 1024;
            end = end - 2;
        } else if (value.endsWith("M") || value.endsWith("m")) {
            multiplier = 1024 * 1024;
            end = end - 1;
        } else if (value.endsWith("MB") || value.endsWith("mb")) {
            multiplier = 1024 * 1024;
            end = end - 2;
        } else if (value.endsWith("G") || value.endsWith("g")) {
            multiplier = 1024 * 1024 * 1024;
            end = end - 1;
        } else if (value.endsWith("GB") || value.endsWith("gb")) {
            multiplier = 1024 * 1024 * 1024;
            end = end - 2;
        }

        return Math.multiplyExact(multiplier, Long.parseLong(value.substring(0, end)));
    }