Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String repeat(char c, int count) {
- StringBuffer buffer = new StringBuffer(count);
- for (int i = 0; i < count; i++)
- buffer.append(c);
- return buffer.toString();
- }
- public static String repeat(String s, int count) {
- StringBuffer buffer = new StringBuffer(s.length() * count);
- for (int i = 0; i < count; i++)
- buffer.append(s);
- return buffer.toString();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement