• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 274
  • Last Modified:

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
0
lacroix_al
Asked:
lacroix_al
  • 3
  • 2
  • 2
  • +2
1 Solution
 
CEHJCommented:
Long.toString(n, 16);
0
 
hongjunCommented:
Integer.toHexString(myLong);
0
 
CEHJCommented:
(Of course that needs assignment)

String s =  Long.toString(n, 16);
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
hongjunCommented:
try this

String strHexa = Long.toHexString(myLong);
0
 
lacroix_alAuthor Commented:
Thanks
Al
0
 
Mayank SAssociate Director - Product EngineeringCommented:
>> I have tryied using the toHex(long n).

You mean Long.toHex ( long n ) ? That is already perfectly correct.
0
 
Mayank SAssociate Director - Product EngineeringCommented:
>> Long.toHex ( long n )

Long.toHexString ( long n )
0
 
CEHJCommented:
:-)
0
 
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
yes

String str =  Long.toString(num, 16);

or

String str = Long.toHexString(num);

will solve your problem.

0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now