private static void writeFile(final String path, final Set<Integer> set, final boolean isAppend) throws Exception {
        File file = new File(path);
        FileWriter fileWriter = new FileWriter(file, isAppend);// 第二个参数表示：是否为追加模
        BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
        Iterator<Integer> iterator = set.iterator();
        while (iterator.hasNext()) {
            bufferedWriter.write(iterator.next().toString());
            bufferedWriter.newLine();
        }
        bufferedWriter.flush();
        if (bufferedWriter != null) {
            bufferedWriter.close();
        }
        if (fileWriter != null) {
            fileWriter.close();
        }
    }