code: public static int setProtected(int modifier, boolean b) {
          if (b) {
              return (modifier | PROTECTED) & (~PUBLIC & ~PRIVATE);
          }
          else {
              return modifier & ~PROTECTED;
          }
      }
docs: When set protected, the modifier is cleared from being public or
  private.