public static void main(String[] args) { TextAligner textAligner = new TextAligner(); for (AlignType align : AlignType.values()) { System.out.println("<h1>" + align.toString() + "</h1>"); List<String> list = (textAligner.align(15, 10, align, "Hello world is the common phrase used everywhere. In this sentense somewordsarereallyreallybig ones.")); for (String string : list) { System.out.println("|" + string + "|"); } System.out.println(""); } }which produces the following output
@author Santhosh KumarTOP_LEFT
|Hello world is | |the common | |phrase used | |everywhere. In | |this sentense | |somewordsarerea| |llyreallybig | |ones. | | | | |TOP_CENTER
|Hello world is | | the common | | phrase used | |everywhere. In | | this sentense | |somewordsarerea| | llyreallybig | | ones. | | | | |TOP_RIGHT
| Hello world is| | the common| | phrase used| | everywhere. In| | this sentense| |somewordsarerea| | llyreallybig| | ones.| | | | |MIDDLE_LEFT
| | |Hello world | |is the common | |phrase used | |everywhere. | |In this sentense| |somewordsarerea| |llyreallybig | |ones. | | |MIDDLE_CENTER
| | | Hello world | | is the common | | phrase used | | everywhere. | |In this sentense| |somewordsarerea| | llyreallybig | | ones. | | |MIDDLE_RIGHT
| | | Hello world| | is the common| | phrase used| | everywhere.| |In this sentense| |somewordsarerea| | llyreallybig| | ones.| | |BOTTOM_LEFT
| | | | |Hello world | |is the common | |phrase used | |everywhere. In | |this sentense | |somewordsarerea| |llyreallybig | |ones. |BOTTOM_CENTER
| | | | | Hello world | | is the common | | phrase used | |everywhere. In | | this sentense | |somewordsarerea| | llyreallybig | | ones. |BOTTOM_RIGHT
| | | | | Hello world| | is the common| | phrase used| | everywhere. In| | this sentense| |somewordsarerea| | llyreallybig| | ones.|
|
|