I have this hexadecimal in a nodejs Tcp Client
82380000000000000400000000000000
I have used parseint function to convert it to
1.73090408076117e+38
But i need to get its binary representation that is
10000010001110000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000
Ho can i get this binary representation from the above hexadecimal format?
Using the toString specifying the base as the parameter should make it. For example, if you want to convert it to a binary string, after parsing it to an integer:
var number = '82380000000000000400000000000000';
console.log(parseInt(number).toString(2));
In case you want an hexadecimal string, just use .toString(16);
If you don't want to parse the string with the number:
var number = 82380000000000000400000000000000;
console.log(number.toString(2));
Hope this helps.
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