I need to convert large hex to dec. I already solved it using Java. Here's my solution:
String input = "253D3FB468A0E24677C28A624BE0F939";
System.out.println(new BigInteger(input, 16));
That gives me the following output: 49499458037667732112883750526794135865
.
Very simple using Java's BigInteger class!!
I need the same result using Javascript! I tried:
var str = '253D3FB468A0E24677C28A624BE0F939';
console.log(parseInt(str, 16));
With output 4.949945803766773e+37
.
I think JavaScript's Int isn't enough for this kind. How can i achieve the same Java's output with JavaScript? Thanks a lot!
Use a Big Int library: https://github.com/peterolson/BigInteger.js
var q = new bigInt("253D3FB468A0E24677C28A624BE0F939", 16);
console.log(q.toString());
49499458037667732112883750526794135865
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