As far as I know, there really is no difference. In fact, I wouldn't be at all surprised if the method body of toHexString really consisted nothing more than an invocation of toString. I believe toHexString is supplied as more of a convenience method than anything.

The implementation of toHexString, toOctalString and toBinaryString is simple relative to the implementation of toString(primitive, radix), because toHexString, toOctalString and toBinaryString are working with a radix that is a power of 2. The implementation of the toString(primitive, radix) method is generalized to work with any radix including those that are not a power of 2.

Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>

A bit of necromancy(this post is showed as number one when I searched in google so I decided to post a reply).

The information above is INCORRECT,
those function differ in the way they handle negative numbers:
Long.toHexString(x) will add 2^64, so Long.toHexString(-1) will return ffffffffffffffff
Long.toString(x, 16) will use minus sign instead, so Long.toString(-1, 16) will return -1;

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.