Java concise solution
\nclass Solution {\n    public List<List<Integer>> reconstructMatrix(int upper, int lower, int[] colsum) {\n        List<List<Integer>> matrix = new ArrayList()
```\nclass Solution {\n    public List<List<Integer>> reconstructMatrix(int upper, int lower, int[] colsum) {\n        List<List<Integer>> matrix = new ArrayList();\n        List<Integer> top = new ArrayList();\n        List<Integer> bottom = new ArrayList();\n        for (int num : colsum) {\n            if (num == 0) {\n                top.add(0);\n                bottom.add(0);\n            } else if (num == 2) {\n                top.add(1);\n                bottom.add(1);\n                upper--;\n                lower--;\n            } else if (upper == 0 && lower == 0) {\n                return matrix;\n            } else if (upper > lower) {\n                top.add(1);\n                bottom.add(0);\n                upper--;\n            } else {\n                top.add(0);\n                bottom.add(1);\n                lower--;\n            }\n        }\n        if (upper != 0 || lower != 0)\n            return new ArrayList<>();\n        matrix.add(top);\n        matrix.add(bottom);\n        return matrix;\n    }\n}\n```
[]