private Number consumeTokenNumber(char c) throws JsonParserException {
  int start=index - 1;
  int end=index;
  boolean isDouble=false;
  while (isDigitCharacter(peekChar())) {
    char next=(char)advanceChar();
    isDouble=next == '.' || next == 'e' || next == 'E' || isDouble;
    end++;
  }
  String number=string.substring(start,end);
  try {
    if (isDouble) {
      if (number.charAt(0) == '0') {
        if (number.charAt(1) == '.') {
          if (number.length() == 2)           throw createParseException(null,"Malformed number: " + number,true);
        }
 else         if (number.charAt(1) != 'e' && number.charAt(1) != 'E')         throw createParseException(null,"Malformed number: " + number,true);
      }
      if (number.charAt(0) == '-') {
        if (number.charAt(1) == '0') {
          if (number.charAt(2) == '.') {
            if (number.length() == 3)             throw createParseException(null,"Malformed number: " + number,true);
          }
 else           if (number.charAt(2) != 'e' && number.charAt(2) != 'E')           throw createParseException(null,"Malformed number: " + number,true);
        }
 else         if (number.charAt(1) == '.') {
          throw createParseException(null,"Malformed number: " + number,true);
        }
      }
      return Double.parseDouble(number);
    }
    if (number.charAt(0) == '0') {
      if (number.length() == 1)       return 0;
      throw createParseException(null,"Malformed number: " + number,true);
    }
    if (number.length() > 1 && number.charAt(0) == '-' && number.charAt(1) == '0') {
      if (number.length() == 2)       return -0.0;
      throw createParseException(null,"Malformed number: " + number,true);
    }
    int length=number.charAt(0) == '-' ? number.length() - 1 : number.length();
    if (length < 10)     return Integer.parseInt(number);
    if (length < 19)     return Long.parseLong(number);
    return new BigInteger(number);
  }
 catch (  NumberFormatException e) {
    throw createParseException(e,"Malformed number: " + number,true);
  }
}

private Number consumeTokenNumber ( char c ) throws JsonParserException { int start = index - 1 ; int end = index ; boolean isDouble = false ; while ( isDigitCharacter ( peekChar ( ) ) ) { char next = ( char ) advanceChar ( ) ; isDouble = next == '.' || next == 'e' || next == 'E' || isDouble ; end ++ ; } String number = string . substring ( start , end ) ; try { if ( isDouble ) { if ( number . charAt ( 0 ) == '0' ) { if ( number . charAt ( 1 ) == '.' ) { if ( number . length ( ) == 2 ) throw createParseException ( null , "Malformed number: " + number , true ) ; } else if ( number . charAt ( 1 ) != 'e' && number . charAt ( 1 ) != 'E' ) throw createParseException ( null , "Malformed number: " + number , true ) ; } if ( number . charAt ( 0 ) == '-' ) { if ( number . charAt ( 1 ) == '0' ) { if ( number . charAt ( 2 ) == '.' ) { if ( number . length ( ) == 3 ) throw createParseException ( null , "Malformed number: " + number , true ) ; } else if ( number . charAt ( 2 ) != 'e' && number . charAt ( 2 ) != 'E' ) throw createParseException ( null , "Malformed number: " + number , true ) ; } else if ( number . charAt ( 1 ) == '.' ) { throw createParseException ( null , "Malformed number: " + number , true ) ; } } return Double . parseDouble ( number ) ; } if ( number . charAt ( 0 ) == '0' ) { if ( number . length ( ) == 1 ) return 0 ; throw createParseException ( null , "Malformed number: " + number , true ) ; } if ( number . length ( ) > 1 && number . charAt ( 0 ) == '-' && number . charAt ( 1 ) == '0' ) { if ( number . length ( ) == 2 ) return - 0.0 ; throw createParseException ( null , "Malformed number: " + number , true ) ; } int length = number . charAt ( 0 ) == '-' ? number . length ( ) - 1 : number . length ( ) ; if ( length < 10 ) return Integer . parseInt ( number ) ; if ( length < 19 ) return Long . parseLong ( number ) ; return new BigInteger ( number ) ; } catch ( NumberFormatException e ) { throw createParseException ( e , "Malformed number: " + number , true ) ; } }
steps through to the end of the current number token ( a non - digit token ) .
