It might help,
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
BitWiseComplement("11000");
BitWiseComplement("00111111111111");
BitWiseComplement("11000000000000");
BitWiseComplement("11111111100000");
BitWiseComplement("11111100001111");
}
static void BitWiseComplement(string firstBinaryNumber)
{
int result = Convert.ToInt32(firstBinaryNumber, 2);
Console.WriteLine("{0,5}\t{1}", result, firstBinaryNumber);
string complementedBinaryNumber = Convert.ToString(~result, 2);
complementedBinaryNumber = complementedBinaryNumber.Remove(0, complementedBinaryNumber.Length - firstBinaryNumber.Length);
Console.WriteLine("{0,5}\t{1}\n", Convert.ToInt32(complementedBinaryNumber, 2), complementedBinaryNumber);
}
}
}
Which will produce following output based on the test data I used,
24 11000
7 00111
4095 00111111111111
12288 11000000000000
12288 11000000000000
4095 00111111111111
16352 11111111100000
31 00000000011111
16143 11111100001111
240 00000011110000
Hope it helps :)