[Java] Easy 100% solution with StringBuilder
java\nclass Solution {\n    public String[] divideString(final String s, final int k, final char fill) {\n        final StringBuilder sb = new StringBuilder();\
```java\nclass Solution {\n    public String[] divideString(final String s, final int k, final char fill) {\n        final StringBuilder sb = new StringBuilder();\n        final String[] result = new String[s.length() / k + (s.length() % k == 0 ? 0 : 1)];\n        int idx = 0;\n\n        for(int i = 0; i < s.length(); ++i) {\n            sb.append(s.charAt(i));\n\n            if((i + 1) % k == 0) {\n                result[idx++] = sb.toString();\n                sb.setLength(0);\n            }\n        }\n\n        if(sb.length() > 0 && sb.length() < k) {\n            for(int i = sb.length(); i < k; ++i)\n                sb.append(fill);\n\n            result[idx] = sb.toString();\n        }\n\n        return result;\n    }\n}\n```
['Java']