Java Solution [ With Explanation ]
Key Points : \n1. Since we are representing a number bitwise, each bit needs to be a positive value i.e 0 or 1\n2. What is so special about -ve bases? Absolutel
### Key Points : \n1. Since we are representing a number bitwise, each bit needs to be a positive value i.e 0 or 1\n2. What is so special about -ve bases? Absolutely nothing, converting to negative base b is same as converting to positive base b, only you have to keep one thing in mind\n\t* \tIf rem comes out to be negative then do n++ and add -b to rem\nWell I am not done yet, why do we have to do this? Let\'s look at it mathematically.\n\n`a = (\u2212r)c + d = (\u2212r)c + d \u2212 r + r = (\u2212r)(c + 1) + (d + r)`\n\nref : [Wikipedia](https://en.wikipedia.org/wiki/Negative_base#Calculation)\n\nclass Solution {\n    \n\tpublic String baseNeg2(int n) {\n        \n        if(n==0) return "0";\n        \n        StringBuilder ans = new StringBuilder("");\n        while(n!=0){\n            int rem = n%(-2);\n            n /= -2; \n            if(rem<0){\n                n++;\n                rem += 2;\n            }\n            ans.insert(0, rem+""); \n        }        \n        \n        return ans.toString();        \n    }\n}
[]