I have the following:
public int [] PermuteNum(int num)
{
int[] newArray = new int[16];
string strNum = Convert.ToString(num, 2);
int[] bits = strNum.PadLeft(16, '0').Select(c => int.Parse(c.ToString())).ToArray();
for (int i = 0; i < bits.Length; i++)
{
int newBit = P(i);
int NewNum = bits[newBit];
newArray[i] = NewNum;
}
return newArray;
}
How do I convert this array of ones and zeros back to my initial int? The first element is the most significant bit.