code: function encode(events) {
    if(!Array.isArray(events)) {
      return '00';
    }
    let bitmask = 0;
    for(event in events) {
      let index = events[event];
      bitmask += (1 << index);
    }
    return ('00' + bitmask.toString(16)).substr(-2);
  }
docs: Encode the given events index list as a hexadecimal string byte.
  @param {Array} events The given events as an index list.
  @return {String} The resulting hexadecimal string.