标签:
static void Main(string[] args) { // Int32 num1 = 4; //long num1 = 4; Int64 num1 = 4; byte[] bs = BitConverter.GetBytes(num1); BitArray arr = new BitArray(bs); var sb = new StringBuilder(); for (int i = arr.Length-1; i >=0; i--) { if (arr[i] == true ) { sb.Append("1"); } else { sb.Append("0"); } } Console.WriteLine(string.Format("Length is :{0}",arr.Length)); Console.WriteLine(sb.ToString()); Console.ReadKey(); }
标签:
原文地址:http://www.cnblogs.com/micro-chen/p/4195612.html