>To find the number of bits needed to store the value as a signed value,
add one, i.e. use <code>x.bitLength + 1</code>.</p>
<pre class="language-dart"><code>x.bitLength == (-x-1).bitLength

3.bitLength == 2;     // 00000011
2.bitLength == 2;     // 00000010
1.bitLength == 1;     // 00000001
0.bitLength == 0;     // 00000000
(-1).bitLength == 0;  // 11111111
(-2).bitLength == 1;  // 11111110
(-3).bitLength == 2;  // 11111101
(-4).bitLength == 2;  // 11111100
</code></pre>
        </section>
                