Intuitive Java Solution With Clear Explanation
Idea\nThe logic is similar to positive base logic. But the difference is when remainder is negative.\nWhy would that matter? Basically, remainders are going to 
**Idea**\nThe logic is similar to positive base logic. But the difference is when `rem`ainder is negative.\nWhy would that matter? Basically, remainders are going to be the digits we use in the output. So we can\'t have negative numbers there, right?\n\nSo how do we handle it? Eg: For `num/base`, we have `num=base*q+d` where `d` is the remainder and `q` is the quotient. If `d` is negative, we can make it positive as follows:\n`num=base*q-r+(d+r)`  where `base=-r`\n`num=(q+1)*base+(d+r)`\n\n*Ref*: https://en.wikipedia.org/wiki/Negative_base\n\n```\npublic String baseNeg2(int n) {\n        if(n == 0) return "0";\n        StringBuilder sb = new StringBuilder();\n    \tint rem = 0, quo = 0, r = 2, base = -r;\n    \twhile(n != 0) {\n    \t\trem = n % base;\n    \t\tquo = n / base;\n    \t\tif(rem < 0) {\n    \t\t\trem += r;\n    \t\t\tquo++;\n    \t\t}\n    \t\tsb.append(rem);\n    \t\tn = quo;\n    \t}\n    \treturn sb.reverse().toString();\n    }\n```
[]