-
Bug
-
Resolution: Not an Issue
-
P5
-
None
-
8, 25
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
Windows 11, Java 21.0.7
A DESCRIPTION OF THE PROBLEM :
When attempting to parse the following binary string:
1000000100000001100000100000001010000011000000111000010000000100
I get a NumberFormatException despite this being a valid 64-bit number.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See test case code.
ACTUAL -
Exception in thread "main" java.lang.NumberFormatException: For input string: "1000000100000001100000100000001010000011000000111000010000000100" under radix 2
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
at java.base/java.lang.Long.parseLong(Long.java:709)
at sandbox.Sandbox.main(Sandbox.java:11)
---------- BEGIN SOURCE ----------
public static void main(String[] args) throws Exception
{
long x = -9_150_890_020_540_546_044l;
String str = Long.toBinaryString(x);
long y = Long.parseLong(str, 2); //throws exception
System.out.println(x == y); //should be the same
}
---------- END SOURCE ----------
Windows 11, Java 21.0.7
A DESCRIPTION OF THE PROBLEM :
When attempting to parse the following binary string:
1000000100000001100000100000001010000011000000111000010000000100
I get a NumberFormatException despite this being a valid 64-bit number.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See test case code.
ACTUAL -
Exception in thread "main" java.lang.NumberFormatException: For input string: "1000000100000001100000100000001010000011000000111000010000000100" under radix 2
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
at java.base/java.lang.Long.parseLong(Long.java:709)
at sandbox.Sandbox.main(Sandbox.java:11)
---------- BEGIN SOURCE ----------
public static void main(String[] args) throws Exception
{
long x = -9_150_890_020_540_546_044l;
String str = Long.toBinaryString(x);
long y = Long.parseLong(str, 2); //throws exception
System.out.println(x == y); //should be the same
}
---------- END SOURCE ----------