title: How -128 fits in a sbyte
body: <p>As I remember we had learned that signed integer types (sbyte, short, int , long)
  the first bit is for the sign and the latter 7 bit is for the value.</p>
  
  <p>I saw that sbyte range is -128 to 127 while I thought it must be -127 to 127.</p>
  
  <p>I tried some codes to understand how this is possible and I faced two strange things:</p>
  
  <p>1- I tried the following code:</p>
  
  <pre><code>sbyte a = -128;
  Console.Write(Convert.ToString(a, 2));
  </code></pre>
  
  <p>and the resutl was</p>
  
  <blockquote>
    <p>1111111100000000</p>
  </blockquote>
  
  <p>As if its a two byte variable.</p>
  
  <p>2-Tried converting all numbers in the range to binary:</p>
  
  <pre><code>for(sbyte i=-128;i&lt;=127;i++)
  {
      Console.WriteLine(Convert.ToString(i, 2));
      if(i==127) break;
  }
  </code></pre>
  
  <p>If I omit the <code>if(i==127) break;</code> the loop goes on. and with the break, the code in the loop does not execute, some how as if -128 is greater than 127.</p>
  
  <p><strong>My Conclusion:</strong>
  As I thought that -128 must not fit in a unsigned byte variable and the first and second tries approves that (111111110000000 > 01111111)
  but If it does not fit, then why range is -128 to 127?</p>