@Test public void testRepeat() { assertEquals("", SimpleTools.repeat("", 11)); assertEquals("", SimpleTools.repeat("adwdw", 0)); assertEquals("", SimpleTools.repeat("adwdw", -10)); assertNull(SimpleTools.repeat(null, 100)); assertEquals("xxxx", SimpleTools.repeat("x", 4)); assertEquals("101010", SimpleTools.repeat(10, 3)); }
public static String repeat(String string, int count) { if (string == null) { return null; } else if (string.isEmpty() || count <= 0) { return ""; } StringBuffer result = new StringBuffer(); for (int i = 0; i < count; i++) { result.append(string); } return result.toString(); }
SimpleTools { public static String repeat(String string, int count) { if (string == null) { return null; } else if (string.isEmpty() || count <= 0) { return ""; } StringBuffer result = new StringBuffer(); for (int i = 0; i < count; i++) { result.append(string); } return result.toString(); } }
SimpleTools { public static String repeat(String string, int count) { if (string == null) { return null; } else if (string.isEmpty() || count <= 0) { return ""; } StringBuffer result = new StringBuffer(); for (int i = 0; i < count; i++) { result.append(string); } return result.toString(); }  }
SimpleTools { public static String repeat(String string, int count) { if (string == null) { return null; } else if (string.isEmpty() || count <= 0) { return ""; } StringBuffer result = new StringBuffer(); for (int i = 0; i < count; i++) { result.append(string); } return result.toString(); }  static long longHash(String s); static String createRandomString(int length); static String join(Object[] objects, String glue); static String join(Iterable<?> objects, String glue); static String repeat(String string, int count); static String repeat(Object o, int count); static byte[] toByteArray(InputStream is); static String byteToHexString(byte[] bytes); static int getSystemDefinedPort(); }
SimpleTools { public static String repeat(String string, int count) { if (string == null) { return null; } else if (string.isEmpty() || count <= 0) { return ""; } StringBuffer result = new StringBuffer(); for (int i = 0; i < count; i++) { result.append(string); } return result.toString(); }  static long longHash(String s); static String createRandomString(int length); static String join(Object[] objects, String glue); static String join(Iterable<?> objects, String glue); static String repeat(String string, int count); static String repeat(Object o, int count); static byte[] toByteArray(InputStream is); static String byteToHexString(byte[] bytes); static int getSystemDefinedPort(); static final String sRandomStringCharSet; }