title: How to get the value of a bit at a certain position from a byte?
body: <p>If I have a byte, how would the method look to retrieve a bit at a certain position?</p>
  
  <p>Here is what I have know, and I don't think it works.</p>
  
  <pre><code>public byte getBit(int position) {
      return (byte) (ID &gt;&gt; (position - 1));
  }
  </code></pre>
  
  <p>where <code>ID</code> is the name of the byte I am retrieving information from.</p>