public class AddressGen
1:
2: package test;
3:
4: import java.text.DecimalFormat;
5:
6: public class AddressGen {
7:
8: public static final void main(String[] args) {
9: for (int i = 0; i < 20; i++) {
10: int n1 = (int) (Math.random() * 1000);
11: int n2 = (int) (Math.random() * 100000);
12: while (n2 < 10000) {
13: n2 = (int) (Math.random() * 100000);
14: }
15: int n3 = (int) (Math.random() * 1000);
16: while (n3 < 100) {
17: n3 = (int) (Math.random() * 1000);
18: }
19: int n4 = (int) (Math.random() * 1000);
20: while (n4 < 100) {
21: n4 = (int) (Math.random() * 1000);
22: }
23: int n5 = (int) (Math.random() * 10000);
24: DecimalFormat df1 = new DecimalFormat("0000");
25: String s5 = df1.format(n5);
26:
27: int n6 = ((int) (Math.random() * 50)) * 4;
28:
29: double gpa = (Math.random() * 4) + 0.01;
30: DecimalFormat df2 = new DecimalFormat("0.00");
31: String s7 = df2.format(gpa);
32:
33: System.out.println(n1 + "\t" + n2 + "\t" + n3 + "-" + n4 + "-" + s5 + "\t" + n6 +
34: "\t" + s7);
35: }
36: }
37:
38: }