12345678910111213141516171819202122232425262728293031323334353637383940 |
- package me.yoqi.composename;
- import java.util.ArrayList;
- import qh.lqg.utils.Messages;
- import qh.lqg.utils.TextHelper;
- /**
- * ClassName: Compose <br/>
- * Function: 对3500个汉字两两组合. <br/>
- * date: 2016年8月7日 上午11:51:28 <br/>
- *
- * @author liuyuqi
- * @version
- * @since JDK 1.7
- */
- public class Compose {
- public static void main(String args[]) throws Exception {
- String dataUrl = Messages.getString("Compose.data");
- String resultUrl = "data/result.txt";
- String result = null;
- TextHelper textHelper = new TextHelper();
- ArrayList<String> allChinese = textHelper.readTextByWord(dataUrl);
- ArrayList<String> allChineseName = textHelper.readTextByWord(dataUrl);
- // 两两组合
- for (int i = 0; i < 20; i++) {
- for (int j = i + 1; j < allChinese.size() - 1; j++) {
- allChineseName.add(allChinese.get(i) + allChinese.get(j));
- }
- }
- // 打印输出
- for (int k = 0; k < allChineseName.size(); k++) {
- result += allChineseName.get(k);
- }
- textHelper.writeText(resultUrl, result);
- }
- }
|