title: Split a byte in a list of n bits
body: <p>I have a byte and I have to divide it into blocks of <code>n</code> bits and put these sequences in a list.</p>
  
  <p>Examples:</p>
  
  <p><strong>if n=2:</strong></p>
  
  <pre><code>byte b = {171}_10 = {1010 1011}_2
   --&gt; list = {10, 10, 10, 11}
  </code></pre>
  
  <p><strong>if n=2:</strong></p>
  
  <pre><code>byte b = {108}_10 = {0110 1100}_2
   --&gt; list = {01, 10, 11, 00}
  </code></pre>
  
  <p><strong>if n=3:</strong></p>
  
  <pre><code>byte b = {171}_10 = {1010 1011}_2
   --&gt; list = {101, 010} -&gt; I removed the last 2 bits 
  </code></pre>
  
  <p><strong>if n=3:</strong></p>
  
  <pre><code>byte b = {108}_10 = {0110 1100}_2
   --&gt; list = {011, 011}  -&gt; I removed the last 2 bits 
  </code></pre>
  
  <p>How can I do this?</p>