title: Lightweight method of decoding base16 (hexadecimals) of mixed case
body: <p>Guava has interface that allows for <a href="http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/io/BaseEncoding.html#base16%28%29" rel="nofollow">base16/hexadecimal</a> encoding and decoding. Is there a lightweight method or trick for reading in hexadecimals that may contain mixed case? </p>
  
  <p>With lightweight I mean:</p>
  
  <ul>
  <li>no copying of the input string (so no <code>toUpperCase()</code> allowed)</li>
  <li>few lines of code</li>
  <li>low amount of additional instructions (performant)</li>
  </ul>
  
  <p>The solution should not require an additional library on top of Java SE, and should be able to return relatively large byte arrays.</p>
  
  <p>Code sample:</p>
  
  <pre><code>byte[] decoded = BaseEncoding.base16().decode("abCD");
  </code></pre>
  
  <p>will result in:</p>
  
  <blockquote>
    <p>com.google.common.io.BaseEncoding$DecodingException: Unrecognized character: a</p>
  </blockquote>
  
  <p>using Guava version 15.0 (the latest release at the time of this question).</p>