title: Bitwise operators in Javascript and in general
body: <p>I am working on parsing some binary files, I have them opened and in an <code>ArrayBuffer</code>.</p>
  
  <p>In the particular file structure I am reading, there are a number of bits which are <code>boolean</code> and I can check whether they are checked with:</p>
  
  <pre><code>(flag &amp; 1) != 0; // bit 0 
  (flag &amp; 2) != 0; // bit 1 
  (flag &amp; 4) != 0; // bit 2 
  </code></pre>
  
  <p>etc.</p>
  
  <p>However, I am having trouble getting the values of the bits followed. They span over multiple bits (for example bits 4-6) and consist of an integer value from 0-7. </p>
  
  <p>How are multiple bits read like that? I understand that this isn't as much of a JavaScript question than that of how bits and bitwise operators work.</p>