I have an int array of bits (length always 64) like:
1110000100000110111001000001110010011000110011111100001011100100
and I want to write it in one Int64
(or ulong?) variable. How to do it?
I tried to create a BitArray
and then get int
, but it throws System.ArgumentException
, on CopyTo line:
private static Int64 GetIntFromBitArray(BitArray bitArray) {
var array = new Int64[1];
bitArray.CopyTo(array, 0);
return array[0];
}