Finish of pure Java integer encoding.

This is a little over 2x faster now than without the ext.