<p>I'm talking about this:</p>

<p>If we have the letter 'A' which is 77 in decimal and 4D in Hex.
I am looking for the fastest way to get D.</p>

<p>I thought about two ways:</p>

<p>Given x is a byte.</p>

<ol>
<li><p><code>x &lt;&lt; 4; x &gt;&gt; 4</code></p></li>
<li><p><code>x %= 16</code></p></li>
</ol>

<p>Any other ways? Which one is faster?</p>

Single AND operation can do it.
```
```
x = (x & 0x0F);
```
```