H
Hans
Hello,
I have found a very strange bug in JDK 1.4. A huge long constant assignment
works fine, but if I want to parse the same huge long as string, it gives an
exception. See below!
If I remove 1 String digit, it works fine. It seems that parseLong has wrong
max value checking?
Why doesn't this work and how can I parse legal huge long values?
public static void main(String[] args)
{
// the compiler doesn't complain about this
long x = 0xFF7FFFFF80000000L;
// but this result in a NumberFormatException
long y = Long.parseLong("FF7FFFFF80000000");
}
Thanks!
Jos
I have found a very strange bug in JDK 1.4. A huge long constant assignment
works fine, but if I want to parse the same huge long as string, it gives an
exception. See below!
If I remove 1 String digit, it works fine. It seems that parseLong has wrong
max value checking?
Why doesn't this work and how can I parse legal huge long values?
public static void main(String[] args)
{
// the compiler doesn't complain about this
long x = 0xFF7FFFFF80000000L;
// but this result in a NumberFormatException
long y = Long.parseLong("FF7FFFFF80000000");
}
Thanks!
Jos