Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

# Thread: Theoretical numeric data minimization

1. ## Theoretical numeric data minimization

I have been working on a program for about a year now that encodes and decodes text files. The problem is that encoded text files are far larger than their originals. I want them to be smaller. There is an intermediate step in the converting algorithm that changes the letters into ASCII code, which is where the numbers come in. I was wondering if there was a way to reduce the amount of letters by combining them in some way while keeping the original text.
A simpler way to put it is:
I have two numbers that range from 0-255. I need to combine them into one number between 0 and 225, or I need to combine them into two smaller numbers who's total length (character-wise) is not greater than that of the original two. The catch is, I also need to get them back in their original form, so simply subtracting the smaller from the larger won't work. Also, all of the numbers must be integers, so division will probably not be very practical.
I've been trying to figure out an answer to this problem for a while, and I don't even know if there is one.

Thanks,

Xenone

2. ## Re: Theoretical numeric data minimization

Sounds like you want a data compression algorithm. There are many algorithms to accomplish this: have a look at Data compression - Wikipedia, the free encyclopedia