[Java] O(N) 1 Pass Solution, final answer always have at most 1 zero
Find the amount of zero in the string\n- by first zero occurence, determine the desired index to put the 0 if exist, and fill the rest as 1\n\nclass Solution {\
- Find the amount of zero in the string\n- by first zero occurence, determine the desired index to put the 0 if exist, and fill the rest as 1\n```\nclass Solution {\n    public String maximumBinaryString(String binary) {\n        char[] curr = binary.toCharArray();\n        int zero = 0;\n        int index = -1;\n        for(int i = 0; i < curr.length; i++) {            \n            if(curr[i] == \'0\') {\n                zero++;\n                if(index == -1)\n                    index = i;\n            }\n        }\n        Arrays.fill(curr, \'1\');\n        if(index != -1) {\n            curr[index + zero - 1] = \'0\';\n        }\n        return new String(curr);\n    }\n}\n```
[]