public void encodeVarBits(int value) throws IOException {
        int range = 0;
        while (value > range) {
            encodeBit(false);
            value -= range + 1;
            range = 2 * range + 1;
        }
        encodeBit(true);
        encodeBounded(range, value);
    }
DataOutputStream for fast-compact encoding of number sequences

@author ab
main/src/main/java/cgeo/geocaching/brouter/util/MixCoderDataOutputStream.java