Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1 @@
"ha".repeat(5);

View file

@ -0,0 +1,5 @@
String[] strings = new String[5];
Arrays.fill(strings, "ha");
StringBuilder repeated = new StringBuilder();
for (String string : strings)
repeated.append(string);

View file

@ -0,0 +1,5 @@
String string = "ha";
StringBuilder repeated = new StringBuilder();
int count = 5;
while (count-- > 0)
repeated.append(string);

View file

@ -0,0 +1,10 @@
public static String repeat(String str, int times) {
StringBuilder sb = new StringBuilder(str.length() * times);
for (int i = 0; i < times; i++)
sb.append(str);
return sb.toString();
}
public static void main(String[] args) {
System.out.println(repeat("ha", 5));
}

View file

@ -0,0 +1,3 @@
public static String repeat(String str, int times) {
return new String(new char[times]).replace("\0", str);
}