title: Encode String to Base36
body: <p>Currently I am working at an algorithm to encode a normal string with each possible character to a Base36 string.</p>
  
  <p>I have tried the following but it doesn't work.</p>
  
  <pre><code>public static String encode(String str) {
      return new BigInteger(str, 16).toString(36);
  }
  </code></pre>
  
  <p>I guess it's because the string is not just a hex string. If I use the string "Hello22334!" In Base36, then I get a <code>NumberFormatException</code>.</p>
  
  <p>My approach would be to convert each character to a number. Convert the numbers to the hexadecimal representation, and then convert the hexstring to Base36.</p>
  
  <p>Is my approach okay or is there a simpler or better way?</p>