BitSet (boolean applyDefaults) { BitSet state = new BitSet(5); state.set(0, applyDefaults || cbSearchInComments.isSelected()); //cbSearchInComments default is true state.set(1, applyDefaults || cbSearchTextOccurrences.isSelected()); //cbSearchTextOccurrences default is true state.set(2, applyDefaults || cbDeleteEmptySourceFiles.isSelected()); //cbDeleteEmptySourceFiles default is true state.set(3, applyDefaults || cbApplyMPPDeclarationsMove.isSelected()); //cbApplyMPPDeclarationsMove default is true state.set(4, cbSearchReferences.isSelected()); return state; }