I need to compress 20-40 char size of a numeric number to a 6 char size number. So far I have tried Huffman and some Zip algorithms but not getting the desired outcome.
Can some one please advise any other Algorithm/API for this work in Java?
Example:
Input: 98765432101234567890
Desired Output: 123456
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.
Usage: 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.
Assumption/Limits:
If required both client and device(server) can share some common properties required for encoding/decoding the number.
Only one request can be made to a device i.e. all data should be fed in one request, no chunk of small packets
Thanks.
chars. Since a Javacharis 16 bits, that gives you 96 bits, enough to encode all numbers with not more than 28 decimal digits. If you need to handle larger numbers and don't have severe restrictions on what numbers are legitimate, it's simply not possible.