JDK-6624867 : Interger.parseInt does not accept hexadecimal ffffffff
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 6u2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_vista
  • CPU: x86
  • Submitted: 2007-11-01
  • Updated: 2010-04-26
  • Resolved: 2007-11-01
Related Reports
Duplicate :  
Description
java version "1.6.0_02"
 Java(TM) SE Runtime Environment (build 
1.6.0_02-b05)
Java HotSpot(TM) Client VM (build 1.6.0_02-b05, mixed mode)

Does this problem occur on J2SE 1.4.x or 5.0.x ?  Yes / No (pick one)
  Not known

Operating System Configuration Information (be specific):

  Windows Vista

Hardware Configuration Information (be specific):
AMD Athlon X2-64 2Gb RAM


Bug Description:
Integer.parseInt does not accept hexadecimal ffffffff.


Steps to Reproduce (be specific):


Compile and run this program:

public class ParseIntErr {
    public static void main(String[] args){
        int n = Integer.parseInt(args[0],16);
    }
}

E:\alcatel\borsotti\jtest>java ParseIntErr ffffffff

Exception in thread "main" java.lang.NumberFormatException: For input string: "ffffffff"
        at java.lang.NumberFormatException.forInputString(Unknown Source)
        at java.lang.Integer.parseInt
(Unknown Source)
        at ParseIntErr.main(ParseIntErr.java:3)

It is wierd that ParseInt cannot accept an integer that can be specified
in a java source program.

Comments
EVALUATION Yes, it is a known deficiency that parseInt does not accept unsigned hexadecimal input; closing as a duplicate of 4215269.
01-11-2007