public static double convertHumanReadableMemoryToGbytes()

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


    public static double convertHumanReadableMemoryToGbytes(final String memoryString) {
        final Pattern pattern = Pattern.compile(HUMAN_READABLE_MEMORY_STRING_REGEX);
        final Matcher match = pattern.matcher(memoryString);

        if (!match.matches() || match.groupCount() != 3) {
            throw new GridEngineException(HttpStatus.INTERNAL_SERVER_ERROR,
                    String.format("Something went wrong while parsing memory string value: %s", memoryString));
        }
        final int factor = "GMKB".indexOf(match.group(2).charAt(0));
        return Double.parseDouble(match.group(1)) / Math.pow(THOUSAND, factor);
    }