Displaying a String array in tabular format
First you should use a Method for repeating a character/String (if there isn't one yet. Don't know, never need it so far). Like a repeat-Method ->

    public String repeat(int times, String str) {
        // Add some security checks ofc, just to show what I mean.
        String r = "";
        for (int i=0; i &lt; times; i++) r += str;
        return r;
    }


So, since multible characters won't be a problem now anymore:

    // ...
    // Amount of columns you want to have
    int col = 3;
    // Maximal Length of a String you support
    int len = 20;
    for (int i=0; i &lt; theArray.length; i+=col) {
        System.out.println(repeat(len+col+1,"-"));
        System.out.print("|");
        for (int c = 0; c &lt; i; c++)
            // Add some checks to align it into the center when you want/need it
            System.out.print(i + repeat(len-(i+"".length()), " ") + "|");
        System.out.print("\n");
        System.out.println(repeat(len+col+1, "-"));
        for (int c = 0; c &lt; i; c++)
            // Filling up the rest of the String with spaces so the table wont freak out
            System.out.print(theArray[i+c] + repeat(len-theArray[i+c].length(), " ") + "|");
        System.out.print("\n");
    }
    System.out.println(repeat(len+col+1, "-"));