public static int roman(final String value) {
        int result = 0;
        int lastDigit = -1;
        char last = '-';
        for (char current : value.toUpperCase(Locale.US).toCharArray()) {
            final int currentDigit = romanDigit(current);
            if (last != '-') {
                if (currentDigit <= lastDigit) {
                    result += lastDigit;
                } else {
                    result -= lastDigit;
                }
            }
            last = currentDigit < 0 ? '-' : current;
            lastDigit = currentDigit;
        }
        if (last != '-') {
            result += lastDigit;
        }
        return result;
    }
Holds implementations for functions in Formula
main/src/main/java/cgeo/geocaching/utils/formulas/FormulaUtils.java