标签:span eric ogr using collect main bit pad opera
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleAppConvert { class Program { static void Main(string[] args) { for (int i = 1; i < 10;i++ ) { String str = Convert.ToString(i).PadLeft(8, ‘0‘); Console.WriteLine(str); } Console.WriteLine("================================="); byte b = 0xC1; if ((b>>7)!=0) { Console.WriteLine("{0} ‘s bit 8 is 1", Convert.ToString(b, 2).PadLeft(8, ‘0‘)); } else { Console.WriteLine("{0} ‘s bit 8 is 0", Convert.ToString(b, 2).PadLeft(8, ‘0‘)); } b = 0x41; if ((b >> 7) != 0) { Console.WriteLine("{0} ‘s bit 8 is 1", Convert.ToString(b, 2).PadLeft(8, ‘0‘)); } else { Console.WriteLine("{0} ‘s bit 8 is 0", Convert.ToString(b, 2).PadLeft(8, ‘0‘)); } /* 11000001 ‘s bit 8 is 1 01000001 ‘s bit 8 is 0 */ /////////////////////////////////////// } } } /* 00000001 00000002 00000003 00000004 00000005 00000006 00000007 00000008 00000009 请按任意键继续. . . */
标签:span eric ogr using collect main bit pad opera
原文地址:http://www.cnblogs.com/sky20080101/p/6806142.html