public long nextLong() throws IOException {
    peek();
    if (token != JsonToken.STRING && token != JsonToken.NUMBER) {
      throw new IllegalStateException("Expected a long but was " + token
          + " at line " + getLineNumber() + " column " + getColumnNumber());
    }

    long result;
    try {
      result = Long.parseLong(value);
    } catch (NumberFormatException ignored) {
      double asDouble = Double.parseDouble(value); // don't catch this NumberFormatException
      result = (long) asDouble;
      if (result != asDouble) {
        throw new NumberFormatException("Expected a long but was " + value
            + " at line " + getLineNumber() + " column " + getColumnNumber());
      }
    }

    if (result >= 1L && value.startsWith("0")) {
      throw new MalformedJsonException("JSON forbids octal prefixes: " + value
          + " at line " + getLineNumber() + " column " + getColumnNumber());
    }

    advance();
    return result;
  }
public long nextLong() throws IOException {
    peek();
    if (token != JsonToken.STRING && token != JsonToken.NUMBER) {
      throw new IllegalStateException("Expected a long but was " + token
          + " at line " + getLineNumber() + " column " + getColumnNumber());
    }

    long result;
    try {
      result = Long.parseLong(value);
    } catch (NumberFormatException ignored) {
      double asDouble = Double.parseDouble(value); 
      result = (long) asDouble;
      if (result != asDouble) {
        throw new NumberFormatException("Expected a long but was " + value
            + " at line " + getLineNumber() + " column " + getColumnNumber());
      }
    }

    if (result >= 1L && value.startsWith("0")) {
      throw new MalformedJsonException("JSON forbids octal prefixes: " + value
          + " at line " + getLineNumber() + " column " + getColumnNumber());
    }

    advance();
    return result;
  }
public long nextLong ( ) throws IOException { peek ( ) ; if ( token != JsonToken . STRING && token != JsonToken . NUMBER ) { throw new IllegalStateException ( "Expected a long but was " + token + " at line " + getLineNumber ( ) + " column " + getColumnNumber ( ) ) ; } long result ; try { result = Long . parseLong ( value ) ; } catch ( NumberFormatException ignored ) { double asDouble = Double . parseDouble ( value ) ; // don't catch this NumberFormatException result = ( long ) asDouble ; if ( result != asDouble ) { throw new NumberFormatException ( "Expected a long but was " + value + " at line " + getLineNumber ( ) + " column " + getColumnNumber ( ) ) ; } } if ( result >= 1L && value . startsWith ( "0" ) ) { throw new MalformedJsonException ( "JSON forbids octal prefixes: " + value + " at line " + getLineNumber ( ) + " column " + getColumnNumber ( ) ) ; } advance ( ) ; return result ; }
Returns the {@link JsonToken#NUMBER long} value of the next token,
consuming it. If the next token is a string, this method will attempt to
parse it as a long. If the next token's numeric value cannot be exactly
represented by a Java {@code long}, this method throws.

@throws IllegalStateException if the next token is not a literal value.
@throws NumberFormatException if the next literal value cannot be parsed
as a number, or exactly represented as a long.
Returns the { @link JsonToken#NUMBER long } value of the next token consuming it . If the next token is a string this method will attempt to parse it as a long . If the next token s numeric value cannot be exactly represented by a Java { @code long } this method throws .