using System; class Example { public static void Main() { sbyte b = -34; for(int t=128; t > 0; t = t/2) { if((b & t) != 0) Console.Write("1 "); if((b & t) == 0) Console.Write("0 "); } Console.WriteLine(); // reverse all bits b = (sbyte) ~b; for(int t=128; t > 0; t = t/2) { if((b & t) != 0) Console.Write("1 "); if((b & t) == 0) Console.Write("0 "); } } }
1 1 0 1 1 1 1 0 0 0 1 0 0 0 0 1
2.44.Bitwise NOT | ||||
2.44.1. | bitwise NOT for hexadecimal | |||
2.44.2. | The bitwise NOT |