开发者

Convert 64bit Binary to Long equivalent

开发者 https://www.devze.com 2022-12-27 12:11 出处:网络
How can we convert the following 64 bit binary into the long equivalent; 01111101 10100011 01001111 11111111 11111111 11111111 11111111 11000000

How can we convert the following 64 bit binary into the long equivalent;

01111101 10100011 01001111 11111111 11111111 11111111 11111111 11000000  
equals 7D A3 4F FF FF FF FF C0 HEX  
equals 9053167636875050944    << this is the value we want in a C# variable 

EDIT: The large binary number is currently stored as a String. So its a string to long开发者_运维问答 conversion that I am looking for.


Here you go: http://msdn.microsoft.com/en-us/library/system.convert.toint64.aspx

And examples here: http://www.csharphelp.com/2007/09/converting-between-binary-and-decimal-in-c/

Specifically (where bin is a 'binary' string):

long l = Convert.ToInt64(bin,2);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号