This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 5th, 2011  |  syntax: C#  |  size: 0.44 KB  |  views: 40  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  public void run()
  2.         {
  3.             byte a = 255;
  4.             byte b = 85;
  5.             byte c;
  6.        
  7.             a = Convert.ToByte("10101111", 2); //85
  8.             b = Convert.ToByte("011111111", 2); //255
  9.  
  10.             c = (byte)(a & b);
  11.  
  12.             Console.WriteLine("ANDing two bytes  - decimal:{0:D3}  hex:{0:x2}  binary:{1}", c, Convert.ToString(c, 2));
  13.  
  14.             //wait until next press
  15.             Console.ReadKey();
  16.  
clone this paste RAW Paste Data