Created
August 18, 2016 15:33
-
-
Save iporsut/bbd7da6c3c8fd1216d86da3867fc73a9 to your computer and use it in GitHub Desktop.
Java 8 Replicate String
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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