private int buildModeMask() { int mask = 0; for (Mode mode : modes) { mask |= mode.value(); } return mask; }