-
Notifications
You must be signed in to change notification settings - Fork 1
/
Test.java
36 lines (30 loc) · 938 Bytes
/
Test.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package my.Test;
public class Test {
private java.util.Timer timer;
public void run() {
this.timer = new java.util.Timer();
Test test = this;
java.util.TimerTask task = new java.util.TimerTask() {
@Override
public void run() {
test.invoke(test.getValue());
}
};
timer.scheduleAtFixedRate(task, 0, 5);
}
public void stop() {
timer.cancel();
}
public void invoke(StringBuilder arg) {
}
public StringBuilder getValue() {
String ALPHA_NUMERIC_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
StringBuilder builder = new StringBuilder();
int count = 10000;
while (count-- != 0) {
int character = (int) (Math.random() * ALPHA_NUMERIC_STRING.length());
builder.append(ALPHA_NUMERIC_STRING.charAt(character));
}
return builder;
}
}