Updated the logic of VariableByte Java version to match the C++ version

Hi Daniel,

I have updated the Java version of VariableByte to match the logic in the C++ version so that the versions are compatible in the compressed data that they produce. With this change it is now possible to compress in Java and decompress in C++ and vice versa to get back the original content. 

Thanks,
Samit