そこから複製を使用して複製TreeSetを印刷する方法は?
テキスト ファイルからの重複なしで配列を埋めることができるメソッドを作成しました。今度は、それらの重複を別のファイルに書き込む必要があります。それ、どうやったら出来るの?
// method that gets that reads the file and puts it in to an array
public static void readFromfile() throws IOException {
    // Open the file.
    File file = new File("file.txt");
    Scanner inputFile = new Scanner(file);
    // create a new array set Integer list
    Set<Integer> set = new TreeSet<Integer>();
    // add the numbers to the list
    while (inputFile.hasNextInt()) {
        set.add(inputFile.nextInt());
    }
    // transform the Set list in to an array
    Integer[] numbersInteger = set.toArray(new Integer[set.size()]);
    // loop that print out the array
    for (int i = 0; i < numbersInteger.length; i++) {
        System.out.println(numbersInteger[i]);
    }
    // close the input stream
    inputFile.close();
}