504. Base 7  💻 💻|| 🔥🔥 JAVA code...
Code\n\nclass Solution {\n    public String convertToBase7(int num) {\n        String str = "";\n        int a = 0;\n        if(num == 0){\n            return "
# Code\n```\nclass Solution {\n    public String convertToBase7(int num) {\n        String str = "";\n        int a = 0;\n        if(num == 0){\n            return "0"+str;\n        }\n        if(num<0){\n            num = num * (-1);\n            a++;\n        }\n\n        while(num>0){\n            str= num%7+ str;\n            num = num/7;\n        }\n        if(a>0){\n            return "-"+str;\n        }\n        return str;\n    }\n}\n```
['Java']