I am trying to convert UUID which is coming as string to Big Integer but it's failing every time with Number Format exception as it need String Decimal as parameter. Is there any way we can achieve this.
String x = "6CFAFD0DA976088FE05400144FFB4B37";
I tried with radix also but output is different.
BigInteger big = new BigInteger(x, 0);
System.out.println(big);
Any help is appreciated, TIA.
You are supposed to be using radix 16 as your string has alphanumeric values from 0-9 and A-F, set value 16 in radix as you have hexadecimal string.
String x = "6CFAFD0DA976088FE05400144FFB4B37";
BigInteger big = new BigInteger(x, 16);
System.out.println(big);
OUTPUT
144859830291446118078300087367740640055
You need to set radix
value to 16.
For hexadecimal String you need to define the radix value as 16
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With