bitwise AND : Bitwise AND « Data Type « C# / CSharp Tutorial






class MainClass
{

  public static void Main()
  {

    byte byte1 = 0x9a;  // binary 10011010, decimal 154
    byte byte2 = 0xdb;  // binary 11011011, decimal 219
    byte result;

    System.Console.WriteLine("byte1 = " + byte1);
    System.Console.WriteLine("byte2 = " + byte2);

    
    result = (byte) (byte1 & byte2);
    System.Console.WriteLine("byte1 & byte2 = " + result);

  }

}
byte1 = 154
byte2 = 219
byte1 & byte2 = 154








2.43.Bitwise AND
2.43.1.bitwise AND
2.43.2.Use bitwise AND to make a number even
2.43.3.Use bitwise AND to determine if a number is odd.