将整数列表添加到 csv 文件中 (JAVA)

Add a list of integers into a csv file (JAVA)

我想要的只是添加一个算法中的数字列表(这很长所以我不会在这里显示但给出了输出 [2039, 25553, 189030, 1449869, 134295, 352258, 1588788 , 718293, 353578, 1495712, 539563, 1691741, 1032543, 362844, 1143463, 4671463])

List<Integer> List1 = new ArrayList<>();

到 csv 文件并从中生成折线图。 我已经做了一些寻找答案的工作,但我找不到任何具体的答案。 非常感谢任何帮助,谢谢!

public class Try
{
    public static void main(String[] args) throws IOException
    {
        List<Integer> List1 = new ArrayList<>();

        //For the example, i populate the list
        List1.add(123);
        List1.add(456);
        List1.add(789);

        PrintWriter outFile = new PrintWriter(new FileWriter("outNumbers.csv"));

        List1.stream().forEach(i->outFile.print(i + ", "));

        outFile.close();
    }
}