20.7
java.lang.Integer
THE PACKAGE JAVA.LANG
20.7.17
public static int parseInt(String s)
throws NumberFormatException
The argument is interpreted as representing a signed decimal integer. The compo 
nents of the string must all be decimal digits, except that the first character may be
   
  (
 \u002d 
) to indicate a negative value. The resulting integer value is
returned, exactly as if the argument and the radix
10
 were given as arguments to
the
parseInt
 method that takes two arguments ( 20.7.18).
20.7.18
public static int parseInt(String s, int radix)
throws NumberFormatException
The first argument is interpreted as representing a signed integer in the radix spec 
ified by the second argument. The components of the string must all be digits of
the specified radix (as determined by whether
Character.digit
 ( 20.5.23)
returns a nonnegative value), except that the first character may be
   
(
 \u002d 
) to indicate a negative value. The resulting integer value is returned.
An exception of type
NumberFormatException
 is thrown if any of the fol 
lowing situations occurs:
The first argument is
null
 or is a string of length zero.
The
radix
 is either smaller than
Character.MIN_RADIX
 ( 20.5.3) or larger
than
Character.MAX_RADIX
 ( 20.5.4).
Any character of the string is not a digit of the specified
radix
, except that the
first character may
be
a minus sign
   
 (
 \u002d 
) provided that the string
is longer than length 1.
The integer value represented by the string is not a value of type
int
.
Examples:
parseInt("0", 10)
returns
 0
parseInt("473", 10)
returns
 473
parseInt(" 0", 10)
returns
 0
parseInt(" FF", 16)
returns
  255
parseInt("1100110", 2)
returns
 102
parseInt("2147483647", 10)
returns
 2147483647
parseInt(" 2147483648", 10)
returns
  2147483648
parseInt("2147483648", 10)
throws a
 NumberFormatException
parseInt("99", 8)
throws a
 NumberFormatException
parseInt("Kona", 10)
throws a
 NumberFormatException
parseInt("Kona", 27)
returns
 411787
492






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved