Long.toHexString

Returns a string representation of the {@code long} argument as an unsigned integer in base 16.

<p>The unsigned {@code long} value is the argument plus 2<sup>64</sup> if the argument is negative; otherwise, it is equal to the argument. This value is converted to a string of ASCII digits in hexadecimal (base&nbsp;16) with no extra leading {@code 0}s.

<p>The value of the argument can be recovered from the returned string {@code s} by calling {@link Long#parseUnsignedLong(string, int) Long.parseUnsignedLong(s, 16)}.

<p>If the unsigned magnitude is zero, it is represented by a single zero character {@code '0'} ({@code '\u005Cu0030'}); otherwise, the first character of the representation of the unsigned magnitude will not be the zero character. The following characters are used as hexadecimal digits:

<blockquote> {@code 0123456789abcdef} </blockquote>

These are the characters {@code '\u005Cu0030'} through {@code '\u005Cu0039'} and {@code '\u005Cu0061'} through {@code '\u005Cu0066'}. If uppercase letters are desired, the {@link java.lang.string#toUpperCase()} method may be called on the result:

<blockquote> {@code Long.toHexString(n).toUpperCase()} </blockquote>

@param i a {@code long} to be converted to a string. @return the string representation of the unsigned {@code long} value represented by the argument in hexadecimal (base&nbsp;16). @see #parseUnsignedLong(string, int) @see #toUnsignedString(long, int)

class Long
static
string
toHexString
(
long i
)

Meta