-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPP1.java
More file actions
46 lines (32 loc) · 977 Bytes
/
Copy pathPP1.java
File metadata and controls
46 lines (32 loc) · 977 Bytes
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
37
38
39
40
41
42
43
44
45
46
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class PP1 {
/**
* @param args
*/
public static void main(String[] args) {
System.out.println("usage: java pp1 input output");
System.out.println("args[1] = " + args[0]);
System.out.println("args[2] = " + args[1]);
try {
BufferedReader bufferedReader = new BufferedReader(new FileReader(args[0]));
PrintWriter pw = new PrintWriter(new File(args[1]));
String line = bufferedReader.readLine();
pw.println(line);
Random randomGenerator = new Random();
while ((line = bufferedReader.readLine()) != null) {
String vals[] = line.split("\t", 2);
pw.println(randomGenerator.nextInt(256) + "\t" + vals[1]);
}
bufferedReader.close();
pw.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}