java similar to base 2
http://www.noteanddata.com/leetcode-1028-Convert-to-Base-negative2-java-solution-note.html\n\n\npublic String baseNeg2(int N) {\n    if(N == 0) return "0";\n   
http://www.noteanddata.com/leetcode-1028-Convert-to-Base-negative2-java-solution-note.html\n\n```\npublic String baseNeg2(int N) {\n    if(N == 0) return "0";\n    StringBuilder sb = new StringBuilder();\n    \n    while(N > 0) {\n        int r = N%2;\n        sb.append(r);\n        if(sb.length()%2 == 0) {\n            N = (N+r)/2;\n        }\n        else {\n            N = (N-r)/2;\n        }\n    }\n    return sb.reverse().toString();\n}\n```
[]