using System.Collections;
public static void Main()
Console.WriteLine(ToBits(x));
Console.WriteLine(ToBits(~x));
Console.WriteLine(ToBits(x));
public static string ToBits(int x)
BitArray b = new BitArray(new int[] { x });
var sb = new StringBuilder();
for (int i = 0; i < b.Length; i++)
sb.Append((bool)b[i] ? "1" : "0" );