In Java
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public String maximumBinaryString(String binary) {\n        int n = binary.length();\n        int firstZero = binary.indexOf(\'0\');\n\n        if (firstZero == -1) {\n            return binary; // No zeros, already maximum\n        }\n\n        int zeroCount = 0;\n        for (int i = firstZero; i < n; i++) {\n            if (binary.charAt(i) == \'0\') {\n                zeroCount++;\n            }\n        }\n\n        int onesBefore = firstZero;\n        int onesAfter = n - firstZero - zeroCount;\n\n        StringBuilder result = new StringBuilder();\n        for (int i = 0; i < onesBefore; i++) {\n            result.append(\'1\');\n        }\n        for (int i = 0; i < zeroCount - 1; i++) {\n            result.append(\'1\');\n        }\n        result.append(\'0\');\n        for (int i = 0; i < onesAfter; i++) {\n            result.append(\'1\');\n        }\n\n        return result.toString();\n    }\n}\n```
['Java']