Easy to understand java solution
\nclass Solution {\n    public List<List<Integer>> reconstructMatrix(int upper, int lower, int[] colsum) {\n        int l = colsum.length;\n        \n        Li
```\nclass Solution {\n    public List<List<Integer>> reconstructMatrix(int upper, int lower, int[] colsum) {\n        int l = colsum.length;\n        \n        List<List<Integer>> out = new ArrayList<>();\n        List<Integer> upperList = new ArrayList<>();\n        List<Integer> lowerList = new ArrayList<>();\n        \n        for(int i=0;i<l;i++){\n            if(colsum[i] == 2){\n                upperList.add(1);\n                lowerList.add(1);\n                upper-=1;\n                lower-=1;\n            }else if(colsum[i] == 0){\n                upperList.add(0);\n                lowerList.add(0);\n            }else if(colsum[i] == 1){\n                if(upper > lower){\n                    upperList.add(1);\n                    lowerList.add(0);\n                    upper-=1;\n                }else{\n                    upperList.add(0);\n                    lowerList.add(1);\n                    lower-=1;\n                }\n            }\n        }\n        \n        if(upper != 0 || lower != 0){\n            return out;\n        }\n        out.add(upperList);\n        out.add(lowerList);\n        return out;\n        \n    }\n}\n```
['Java']