Integer.parseInt

Integer.parseInt

Class Overview | Class Members | This Package | All Packages

Syntax 1
public static int parseInt( String s, int radix ) throws NumberFormatException
Parameters
s
the String containing the integer.
radix
the radix to be used.
Returns
the integer represented by the string argument in the specified radix.
Description
Parses the string argument as a signed integer in the radix specified by the second argument. The characters in the string must all be digits of the specified radix (as determined by whether Character.digit returns a nonnegative value), except that the first character may be an ASCII minus sign '-' to indicate a negative value. The resulting integer value is returned.

Exceptions
NumberFormatException if the string does not contain a parsable integer.



Syntax 2
public static int parseInt( String s ) throws NumberFormatException
Parameters
s
a string.
Returns
the integer represented by the argument in decimal.
Description
Parses the string argument as a signed decimal integer. The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' to indicate a negative value.

Exceptions
NumberFormatException if the string does not contain a parsable integer.