Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.List; public class Main { /** * Write data column. * * @param data the data * @param outputPath the output path */ public static void writeDataColumn(List<? extends Number> data, String outputPath) { File file = new File(outputPath); try { file.createNewFile(); } catch (IOException e1) { e1.printStackTrace(); System.exit(0); } try { BufferedWriter writer = new BufferedWriter(new FileWriter(file)); for (Number value : data) { writer.write(value.toString() + "\n"); } writer.close(); } catch (IOException e) { e.printStackTrace(); System.exit(0); } } }