code: private static long parseExp(char[] in, int offset, int len){
          long exp = 0;
          offset++;
          char c = in[offset];
          len--;
          boolean negexp = (c == '-');
          // optional sign
          if (negexp || c == '+') {
              offset++;
              c = in[offset];
              len--;
          }
          if (len <= 0) // no exponent digits
              throw new NumberFormatException();
          // skip leading zeros in the exponent
          while (len > 10 && (c=='0' || (Character.digit(c, 10) == 0))) {
              offset++;
              c = in[offset];
              len--;
          }
          if (len > 10) // too many nonzero exponent digits
              throw new NumberFormatException();
          // c now holds first digit of exponent
          for (;; len--) {
              int v;
              if (c >= '0' && c <= '9') {
                  v = c - '0';
              } else {
                  v = Character.digit(c, 10);
                  if (v < 0) // not a digit
                      throw new NumberFormatException();
              }
              exp = exp * 10 + v;
              if (len == 1)
                  break; // that was final character
              offset++;
              c = in[offset];
          }
          if (negexp) // apply sign
              exp = -exp;
          return exp;
      }
docs: /*
  parse exponent