首页 > 代码库 > 获取数据到字节-位的显示

获取数据到字节-位的显示

        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();        }

获取数据到字节-位的显示