public static void write(Writer w, List<String[]> table) throws IOException {
        if (w == null)
            throw new NullPointerException("w must not be null");
        if (table == null)
            throw new NullPointerException("table must not be null");

        BufferedWriter bw = new BufferedWriter(w);
        try {
            for (String[] row : table) {
                StringBuilder sb = new StringBuilder();
                for (String col : row) {
                    sb.append(col);
                    sb.append(",");
                }
                sb.deleteCharAt(sb.length() - 1);
                sb.append("\n");
                bw.write(sb.toString());
            }
        } finally {
            bw.close();
        }
    }