Skip to content

Instantly share code, notes, and snippets.

@siosio
Forked from syobochim/genBonJovi.java
Last active August 29, 2015 14:09
Show Gist options
  • Save siosio/08b86d3344e198760e23 to your computer and use it in GitHub Desktop.
Save siosio/08b86d3344e198760e23 to your computer and use it in GitHub Desktop.
package gist;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.function.Supplier;
import java.util.stream.Collectors;
public class BonJobi {
public static void main(String[] args) throws Exception {
genBonjovi();
}
private static void genBonjovi() throws Exception {
List<String> input = Arrays.asList("ジョ", "ン", "ボ", "ヴィ");
StringBuilder result = new StringBuilder();
Supplier<String> supplier = () -> new Random().ints(0, input.size())
.limit(2)
.mapToObj(input::get)
.collect(Collectors.joining());
int count = 0;
while (!result.append(supplier.get()).toString().endsWith("ジョン・ボン・ジョヴィ")) {
count++;
result.append('・');
}
System.out.println(result);
System.out.println(count + " Bon Jovis");
System.out.println("\n" +
" _人人人人人人人人人人人人人人_\n" +
" > You Give Love a Bad Name <\n" +
"  ̄Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y ̄");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment