
Untitled
By: a guest on
Dec 5th, 2011 | syntax:
C# | size: 0.44 KB | hits: 38 | expires: Never
public void run()
{
byte a = 255;
byte b = 85;
byte c;
a = Convert.ToByte("10101111", 2); //85
b = Convert.ToByte("011111111", 2); //255
c = (byte)(a & b);
Console.WriteLine("ANDing two bytes - decimal:{0:D3} hex:{0:x2} binary:{1}", c, Convert.ToString(c, 2));
//wait until next press
Console.ReadKey();