java优雅的输出helloWorld

java优雅的输出helloWorld

九月 25, 2017


在java中很优雅的输出helloworld,可以试一试

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public class Test{
public static void main(String[] args) {
System.out.println(randomString(-229985452) + " " + randomString(-147909649));
}

public static String randomString(int seed){
Random rand = new Random(seed);
StringBuilder sb = new StringBuilder();
while(true){
int n = rand.nextInt(27);
if(n==0) break;
sb.append((char)('`'+n));

}
return sb.toString();
}
}