Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.39 KB | None | 0 0
  1. public static String repeat(char c, int count) {
  2.         StringBuffer buffer = new StringBuffer(count);
  3.         for (int i = 0; i < count; i++)
  4.             buffer.append(c);
  5.         return buffer.toString();
  6.     }
  7.  
  8.     public static String repeat(String s, int count) {
  9.         StringBuffer buffer = new StringBuffer(s.length() * count);
  10.         for (int i = 0; i < count; i++)
  11.             buffer.append(s);
  12.         return buffer.toString();
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement