Skip to content

Instantly share code, notes, and snippets.

@iporsut
Created August 18, 2016 15:33
Show Gist options
  • Select an option

  • Save iporsut/bbd7da6c3c8fd1216d86da3867fc73a9 to your computer and use it in GitHub Desktop.

Select an option

Save iporsut/bbd7da6c3c8fd1216d86da3867fc73a9 to your computer and use it in GitHub Desktop.
Java 8 Replicate String
import java.util.stream.LongStream;
public class Replicate {
public static void replicate(String s, long max) {
LongStream.iterate(0, n -> n + 1).limit(max).forEach(n -> System.out.print("A"));
System.out.println();
}
public static void main(String []args) {
int n = 11;
replicate("A", (long)Math.pow(n,n));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment