aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes toHexString(int i) unnecessary ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "toHexString(int i) unnecessary ?" Watch "toHexString(int i) unnecessary ?" New topic
Author

toHexString(int i) unnecessary ?

Timothy Toe
Ranch Hand

Joined: Oct 19, 2002
Posts: 156
Why wrapper class Integer has 2 methods to convert a base 10 int to a Hex (base 16) string ?
static String toString(int i, int radix)
static String toHexString(int i)
eg: to convert 15 to F
Integer.toHexString(15) returns f
Integer.toString(15, 16) also returns f

If we already have the generic method
static String toString(int i, int radix)
why do we still need
static String toHexString(int i) ?
Doesn’t the former makes the latter unnecessary ?
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
For conveniance, in case you do not want to have to specify the default radix each time you use the method.


SCJP2. Please Indent your code using UBB Code
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: toHexString(int i) unnecessary ?