public static int parse(String input, int radix) {
        if (input == null || input.length() == 0) {
            throw new NumberFormatException("input must be not empty value");
        }
        boolean negative = false;
        char firstChar = input.charAt(0);
        int i = 0;
        if (firstChar < '0') {
            if (firstChar == '-') {
                negative = true;
            } else if (firstChar != '+') {
                throw new NumberFormatException("input must be not empty value");
            }

            if (input.length() == 1) {
                throw new NumberFormatException("input must be not empty value");
            }
            i++;
        }

        int res = 0;
        int digit = 0;
        for (; i < input.length(); i++) {
            res *= radix;
            digit = Character.digit(input.charAt(i), radix);
            res += digit;
        }
        return negative ? -res : res;
    }