question: static public void packInt ( DataOutput out , int value ) throws IOException { int shift = ( value & ~ 0x7F ) ; if ( shift != 0 ) { shift = 31 - Integer . numberOfLeadingZeros ( value ) ; shift -= shift % 7 ; while ( shift != 0 ) { out . writeByte ( ( byte ) ( ( value > > > shift ) & 0x7F ) ) ; shift -= 7 ; } } out . writeByte ( ( byte ) ( ( value & 0x7F ) | 0x80 ) ) ; }
target:  Pack int into an output stream. It will occupy 1-5 bytes depending on value (lower values occupy smaller space)