private int parseReqDigit() { int ch = str[pos++]; if ('0' <= ch && ch <= '9') return ch - '0'; throw new Exception(); }