title: Converting from bitstring to integer
body: <p>I need a function like</p>
  
  <p><code>int GetIntegerFromBinaryString(string binary, int bitCount)</code></p>
  
  <p>if binary = "01111111" and bitCount = 8, it should return 127</p>
  
  <p>if binary = "10000000" and bitCount = 8, it should return -128</p>
  
  <p>The numbers are stored in 2's complement form. How can I do it. Is there any built in functions that would help so that I needn't calculate manually.</p>