Reputation: 143
I hope this makes sense. When I use a Hex editor and hover over a hex value you can see a 8, 16, 32 and 64 bit number (see screen shot for better idea)
Is there a way to pull that number out using Java, I need to pull the 64bit number out I don't know if this is possible?
If any one knows I would be very greatful!
Many thanks in advance.
Upvotes: 2
Views: 2890
Reputation: 82589
If you have a string of HEX that you want to convert to a 64 bit number, you can use
long asHex = Long.parseLong(theHexValue,16); // 16 denotes as hex
This will produce a SIGNED long value. If you're looking for > 2^63
, you need to use BigInteger
BigInteger asHex = new BigInteger(theHexValue,16);
Upvotes: 1