public static void putInt(ByteBuffer out, int x)
    {
        int value = (x < 0 ? -x : x);
        int sign = (x < 0 ? BYTE_SIGN_NEG : BYTE_SIGN_POS);
        int a = (value & 0x3F);
        int more = (value >>>= 6) != 0 ? BYTE_MORE : 0;
        
        out.put( (byte)(more | sign | a) );
        
        while (more != 0)
        {
            a = value & 0x7F;
            more = (value >>>= 7) != 0 ? BYTE_MORE : 0;
            out.put( (byte)(more | a) );
        }
    }