title: Encode/decode a long to a string using a fixed set of letters in Java
body: <p>Given an arbitrary set of letters</p>
  
  <pre><code>String range = "0123456789abcdefghijklmnopABCD#";
  </code></pre>
  
  <p>I am looking for 2 methods to encode/decode from long &lt;-> String</p>
  
  <pre><code>String s = encode( range, l );
  </code></pre>
  
  <p>and</p>
  
  <pre><code>long l = decode( range, s );
  </code></pre>
  
  <p>So <code>decode(range, encode(range, 123456789L)) == 123456789L</code></p>
  
  <p>And if range is "0123456789" thats the usual way of encoding.</p>