code: private JsonToken decodeNumber(char[] chars, int offset, int length) {
          int i = offset;
          int c = chars[i];
  
          if (c == '-') {
              c = chars[++i];
          }
  
          if (c == '0') {
              c = chars[++i];
          } else if (c >= '1' && c <= '9') {
              c = chars[++i];
              while (c >= '0' && c <= '9') {
                  c = chars[++i];
              }
          } else {
              return JsonToken.STRING;
          }
  
          if (c == '.') {
              c = chars[++i];
              while (c >= '0' && c <= '9') {
                  c = chars[++i];
              }
          }
  
          if (c == 'e' || c == 'E') {
              c = chars[++i];
              if (c == '+' || c == '-') {
                  c = chars[++i];
              }
              if (c >= '0' && c <= '9') {
                  c = chars[++i];
                  while (c >= '0' && c <= '9') {
                      c = chars[++i];
                  }
              } else {
                  return JsonToken.STRING;
              }
          }
  
          if (i == offset + length) {
              return JsonToken.NUMBER;
          } else {
              return JsonToken.STRING;
          }
      }
docs: Determine whether the characters is a JSON number. Numbers are of the
  form -12.34e+56. Fractional and exponential parts are optional. Leading
  zeroes are not allowed in the value or exponential part, but are allowed
  in the fraction.