private int readExp(CharArr arr, int lim) throws IOException {
    nstate |= HAS_EXPONENT;
    int ch = getChar(); lim--;

    if (ch=='+' || ch=='-') {
      arr.write(ch);
      ch = getChar(); lim--;
    }

    // make sure at least one digit is read.
    if (ch<'0' || ch>'9') {
      throw err("missing exponent number");
    }
    arr.write(ch);

    return readExpDigits(arr,lim);
  }
private int readExp ( CharArr arr , int lim ) throws IOException { nstate |= HAS_EXPONENT ; int ch = getChar ( ) ; lim -- ; if ( ch == '+' || ch == '-' ) { arr . write ( ch ) ; ch = getChar ( ) ; lim -- ; } if ( ch < '0' || ch > '9' ) { throw err ( "missing exponent number" ) ; } arr . write ( ch ) ; return readExpDigits ( arr , lim ) ; }
call after 'e' or 'E' has been seen to read the rest of the exponent