convert array of 0s and 1s into an int in c#
<p>I have the following:</p>

<pre><code>public int [] PermuteNum(int num)
{
int[] newArray = new int[16];
string strNum = Convert.ToString(num, 2);
int[] bits = strNum.PadLeft(16, '0').Select(c =&gt; int.Parse(c.ToString())).ToArray();

for (int i = 0; i &lt; bits.Length; i++)
{

int newBit = P(i);
int NewNum = bits[newBit];
newArray[i] = NewNum;

}

return newArray;
}
</code></pre>

<p>How do I convert this array of ones and zeros back to my initial <strong>int</strong>? The first element is the most significant bit.</p>
