public static double machineReadableByteCount()

in src/main/java/org/apache/rocketmq/exporter/util/Utils.java [28:38]


    public static double machineReadableByteCount(String humanReadableValue) {
        int unitSize = 1024;
        String[] valueArray = humanReadableValue.split(" ");
        double base = Double.parseDouble(valueArray[0]);
        String unit = valueArray[1];
        if ("B".equals(unit)) {
            return base;
        }
        int exp = "KMGTPE".indexOf(unit.charAt(0)) + 1;
        return  base * Math.pow(unitSize, exp);
    }