code: public static int packLongSize(long value) {
          int shift = 63-Long.numberOfLeadingZeros(value);
          shift -= shift%7; // round down to nearest multiple of 7
          int ret = 1;
          while(shift!=0){
              //PERF remove cycle, just count zeroes
              shift-=7;
              ret++;
          }
          return ret;
      }
docs: Calculate how much bytes packed long consumes.
  
  @param value to calculate
  @return number of bytes used in packed form