FOR JAVA 8 : import static java.util.stream.Collectors.joining; import static java.util.stream.Stream.generate; String repeat(int count) { return Stream.generate(() -> "ABC").limit(count).collect(Collectors.joining()); }