lacroix_al
asked on
Long integer to Hex
Hi,
I am having some trouble converting a long integer to hex.
I have tryied using the toHex(long n).
Is this the proper way to do this or is there a better way?
Al
I am having some trouble converting a long integer to hex.
I have tryied using the toHex(long n).
Is this the proper way to do this or is there a better way?
Al
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Integer.toHexString(myLong );
(Of course that needs assignment)
String s = Long.toString(n, 16);
String s = Long.toString(n, 16);
try this
String strHexa = Long.toHexString(myLong);
String strHexa = Long.toHexString(myLong);
ASKER
Thanks
Al
Al
>> I have tryied using the toHex(long n).
You mean Long.toHex ( long n ) ? That is already perfectly correct.
You mean Long.toHex ( long n ) ? That is already perfectly correct.
>> Long.toHex ( long n )
Long.toHexString ( long n )
Long.toHexString ( long n )
:-)
yes
String str = Long.toString(num, 16);
or
String str = Long.toHexString(num);
will solve your problem.
String str = Long.toString(num, 16);
or
String str = Long.toHexString(num);
will solve your problem.