
import java.io.*;

public class HTMLDatenArray {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        String[] daten = {"1;2;3", "4;5;6", "7;8;9", "D;E;F"};
        //String[] spalten = daten[0].split(";"); //{["1","2","3"]}
        StringBuilder html = new StringBuilder();
        html.append("<html>\n");
        html.append("<body>\n");
        html.append("Hallo Welt!\n");
        html.append("<table border=1 align=\"center\">\n");
        for (int i = 0; i < daten.length; i++) {
            String[] spalten = daten[i].split(";");
            html.append("<tr>\n");
            html.append("<td>" + spalten[0] + "</td><td>" + spalten[1] + "</td><td>" + spalten[2] + "</td>\n");
            html.append("</tr>\n");
        }
        html.append("</table>\n");
        html.append("</body>\n");
        html.append("</html>\n");
        System.out.println(html.toString());

        // Datei schreiben
        String filename = "test.html";
        boolean append = false;
        try {
            FileWriter file = new FileWriter(filename, append);
            BufferedWriter buff = new BufferedWriter(file);
            PrintWriter out = new PrintWriter(buff);
            out.println(html.toString());
            out.flush();
            out.close();
        } catch (IOException e) {
            System.out.println("Error:" + e);
        }
    }

}
