-
Notifications
You must be signed in to change notification settings - Fork 1
/
Z.java
57 lines (43 loc) · 1.37 KB
/
Z.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
public class Z {
public static void main(String a[]) {
File file = new File("./sentence");
Scanner sc;
String str = "";
try {
sc = new Scanner(file);
while (sc.hasNextLine()) {
String s = sc.nextLine();
str += s;
}
String[] arr = str.split(" ");
int previous = 0;
int index = 0;
for (int i = 50; i < arr.length; i += 50) {
String sentense = "{\"value\":\"";
for (int j = previous; j < i+300; j++) {
String st = arr[j];
sentense += st+" ";
System.out.println(st);
}
sentense+="\"}";
File f = new File(index+".json");
if (!f.exists())
f.createNewFile();
BufferedWriter bw = new BufferedWriter(new FileWriter(f));
bw.write(sentense.toLowerCase());
bw.flush();
bw.close();
previous = i;
index++;
}
} catch (Exception e) {
e.printStackTrace();
}
}
}