private static double convertHumanReadableStringToDigits()

in src/main/java/com/epam/grid/engine/provider/utils/NumberParseUtils.java [104:114]


    private static double convertHumanReadableStringToDigits(final String value) {
        final Pattern pattern = Pattern.compile(HUMAN_READABLE_NUMERIC_STRING_REGEX);
        final Matcher match = pattern.matcher(value.trim());

        if (!match.matches() || match.groupCount() != 3) {
            throw new GridEngineException(HttpStatus.INTERNAL_SERVER_ERROR,
                    String.format("Cannot parse value: %s", value));
        }
        final int factor = match.group(2).isEmpty() ? 0 : "KMG".indexOf(match.group(2).charAt(0)) + 1;
        return Double.parseDouble(match.group(1)) * Math.pow(THOUSAND, factor);
    }