java code easy to implement
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 convertToBase7(int num) {\n        if(num==0)\n        return "0";\n        String s="";\n        String o="-";\n        int y=num;\n        num=Math.abs(num);\n        while(num>0)\n        {\n            s+=num%7;\n            num/=7;\n        }\n        StringBuilder k=new StringBuilder();\n        k.append(s);\n        String z=String.valueOf(k.reverse());\n        o+=z;\n        if(y<0)\n        return o;\n        return z;\n        \n    }\n}\n```
['Java']