public void printLongString(int type, int max, String text) throws Exception
    {
        HashMap map = new HashMap();

        String line = "";
        int row_id = 0;

        String[] words = text.split(" ");

        for(int i = 0; i < words.length; i++)
        {
            line = "";

            if (map.containsKey(row_id))
            {
                line = (String)map.get(row_id);
            }

            int length_of_word = words[i].length();
            int length_of_line = line.length();

            if ( (length_of_word + length_of_line) <= max)
            {
                line += " " + words[i];
                map.put(row_id, line);
            }
            else
            {
                row_id += 1;

                line = words[i];

                map.put(row_id, line);
            }
        }

        for (int i = 0; i < map.size(); i++)
        {
            this.printLine(type, (String)map.get(i));
        }
    }