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