Java/J2ME Range Encoder compression

Java/J2ME implementation of a Range Encoding compression

Range Encoding is a lossless compression method described by G N N Martin in his 1979 paper on "Range encoding: an algorithm for removing redundancy from a digitized message".

Range coders are used in conjunction with a probabilistic model to create a compression algorithm. The code provided here uses a simple (order 0) model. The compression performance is not stellar, but it's not too shabby either.

This implementation was based on the notes and sample code at:

Getting the software

Two files are available:


The Compressor class provides two static methods that are simple to use:

	byte[] input;
	byte[] compressed = Compressor.compress(input);
	byte[] decompressed = Compressor.decompress(compressed);


Please report bugs to


Although this code is probably too trifiling to argue over, for the avoidance of doubt and encouragement of comments/contributions it is published under the LGPL.