static void Main() { BitArray bitArray1 = new BitArray(45); foreach (var bit in bitArray1.BitsArray) { Console.Write(bit); } Console.WriteLine(); bitArray1[0] = 1; bitArray1[1] = 1; bitArray1[19] = 1; bitArray1[43] = 1; foreach (var bit in bitArray1.BitsArray) { Console.Write(bit); } Console.WriteLine(); Console.WriteLine(bitArray1); BitArray bitArray2 = new BitArray(100000); bitArray2[0] = 1; bitArray2[1234] = 1; bitArray2[12345] = 1; Console.WriteLine(); Console.WriteLine(bitArray2); // produces OutOfRange Exception (index should be between 1 and 100000) //BitArray bitArray3 = new BitArray(1000000); //Console.WriteLine(bitArray3); }
static void Main() { BitArray num = new BitArray(99999); num[99999] = 1; Console.WriteLine(num); Console.WriteLine(num[6]); }
public static void Main(string[] args) { var num = new BitArray(250); num[0] = 1; num[248] = 1; Console.WriteLine(num); // Using external library to validate the calculations var a = BigInteger.Parse("452312848583266388373324160190187140051835877600158453279131187530910662657"); Console.WriteLine(Environment.NewLine + a.ToBinaryString()); }