As we all know a byte range is 0 to 255
i have two byte, I want to create another number that is reversible but with minimum length that combine these two number and create a new one, the simplest solution is
a = b1 * 1000 + b2
reverse would be
b1 = a / 1000
b2 = a % 1000
the length of above solution varying 0 to 6 length, i want a formula with FIXED and minimum length
Encode:
Decode:
Encoded result always has length 5 (
10000through75535inclusive). And since there are 65536 different pairs (b1, b2) you can’t encode them into numbers of length < 5 (because there are at most 10000 such numbers).