Advertisement
Guest User

Untitled

a guest
Dec 5th, 2011
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.44 KB | None | 0 0
  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.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement