[Java] Good Mask
\nclass Solution {\n    public int maximumGood(int[][] sts) {\n        // 1. generate bitmask\n        int n = sts.length;\n        int res = 0;\n        \n    
```\nclass Solution {\n    public int maximumGood(int[][] sts) {\n        // 1. generate bitmask\n        int n = sts.length;\n        int res = 0;\n        \n        for (int i = (int) Math.pow(2, n); i < (int) Math.pow(2, n + 1); i++) {\n            String bitmask = Integer.toBinaryString(i).substring(1);\n            boolean conflict = false;\n            for (int j = 0; !conflict&&j < n; j++) {\n                if (bitmask.charAt(j) == \'1\') {\n                    // 2. check his statements to others so we know if there\'s a conflict. \n                    for(int k = 0; !conflict&&k< sts[j].length; k++) {\n                        if (sts[j][k]!=2 && sts[j][k] != bitmask.charAt(k)-\'0\') {\n                            // this indicates there\'s a conflict, so this guy is not good as we assumed\n                            conflict=true;\n                        }\n                    }\n                }\n            }\n            if(!conflict) {\n                int temp = 0;\n                for(int x = 0; x< bitmask.length(); x++){\n                    temp+=bitmask.charAt(x)-\'0\';\n                }\n                res = Math.max(temp, res);\n            }\n        }\n        return res;\n    }\n}\n```
['Bitmask', 'Java']