Reference implementation of arithmetic coding in Java