title: Java algorithm to Compress small numeric number
body: <p>I need to compress <strong>20-40</strong> char size of a numeric number to a <strong>6</strong> char size number. So far I have tried <strong>Huffman</strong> and some <strong>Zip</strong> algorithms but not getting the desired outcome.</p>
  
  <p>Can some one please advise any other Algorithm/API for this work in Java?</p>
  
  <p>Example:</p>
  
  <pre><code>Input: 98765432101234567890
  Desired Output: 123456
  </code></pre>
  
  <p>Please note: I didn't mean the output has to come as 12345 for the given input. I only mean that if I specify 20 byte number, it should be compressed to a 6 byte number.</p>
  
  <p><strong>Usage:</strong> Compressed number will be feeded to a device (which can only take up-to-6 numeric chars). Device will decode the number back to the original number.</p>
  
  <p><strong>Assumption/Limits:</strong> </p>
  
  <ol>
  <li><p>If required both client and device(server) can share some common
  properties required for encoding/decoding the number.</p></li>
  <li><p>Only one request can be made to a device i.e. all data should be fed
  in one request, no chunk of small packets</p></li>
  </ol>
  
  <p>Thanks.</p>