HyperX
HyperX

Reputation: 1211

Decimal String to hexadecimal String

I have a String encoded in this kind of format:

223175087923687075112234402528973166755

The decoded string looks like:

a7e5f55e1dbb48b799268e1a6d8618a3

I need to convert from Decimal to Hexadecimal, but the input number is much bigger than the int or long types can handle, so how can I convert this?

Upvotes: 1

Views: 446

Answers (1)

Eran
Eran

Reputation: 393771

You can use BigInteger :

BigInteger big = new BigInteger("223175087923687075112234402528973166755");
System.out.println(big.toString(16));

Output :

a7e5f55e1dbb48b799268e1a6d8618a3

Upvotes: 6

Related Questions