-
Type:
Enhancement
-
Resolution: Not an Issue
-
Priority:
P4
-
None
-
Affects Version/s: 1.0
-
Component/s: core-libs
-
sparc
-
solaris_2.5
Integer.toString always prints the argument as signed, even if the radix
is 8 or 16. Whilst this might occasionally be useful, I would argue this
is not the common case, and that for octal or hex output it is more
likely that the client wants unsigned output.
As an example,
System.out.println(Integer.toString(0xcafebabe, 16));
confusing prints out
-35014542
which is made more confusing by the fact there isn't an alpha-hex digit
in sight!
If nothing else, how about a routine
Integer.toUnsignedString()
or some such?
-- Jon
is 8 or 16. Whilst this might occasionally be useful, I would argue this
is not the common case, and that for octal or hex output it is more
likely that the client wants unsigned output.
As an example,
System.out.println(Integer.toString(0xcafebabe, 16));
confusing prints out
-35014542
which is made more confusing by the fact there isn't an alpha-hex digit
in sight!
If nothing else, how about a routine
Integer.toUnsignedString()
or some such?
-- Jon