function getNextKey(key, len) {
    let /** @type{number} */ step = 1 << (len - 1);
    while ((key & step) != 0) {
      step >>= 1;
    }
    return (key & (step - 1)) + step;
  }
@param {number} key
@param {number} len
@return {number}