code: @Nonnull
      public Number toJavaLangNumber() {
          int flags = getFlags();
          if ((flags & F_DOUBLE) != 0)
              return doubleValue();
          else if ((flags & F_FLOAT) != 0)
              return floatValue();
          else if ((flags & (F_LONG | F_LONGLONG)) != 0)
              return longValue();
          else if ((flags & F_INT) != 0)
              return intValue();
          else if (getFractionalPart() != null)
              return doubleValue();	// .1 is a double in Java.
          else if (getExponent() != null)
              return doubleValue();
          else {
              // This is an attempt to avoid overflowing on over-long integers.
              // However, now we just overflow on over-long longs.
              // We should really use BigInteger.
              long value = longValue();
              if (value <= Integer.MAX_VALUE && value >= Integer.MIN_VALUE)
                  return (int) value;
              return value;
          }
      }
docs: private static final int S_MAXLEN_INT = String.valueOf(Integer.MAX_VALUE).length();