public class TriangleUtilities { public static String getRow(int numberOfStars) { String result=""; for(int i=1;i<= numberOfStars;i++) { result=result+ "*"; } return result; } public static String getTriangle(int numberOfRows) { String result=""; for(int line=1;line<=numberOfRows;line++) { for( int j =1 ; j<=line; j++ ) { result = result+"*" ; } result= result+ "\n"; } return result; } public static String getSmallTriangle() { String result=""; for(int line=1;line<=4;line++) { for( int j =1 ; j<=line; j++ ) { result = result+"*" ; } result= result+ "\n"; // \n to change line } return result; } public static String getLargeTriangle() { String result=""; for(int line=1;line<=9;line++) { for( int j =1 ; j<=line; j++ ) { result = result+"*" ; } result= result+ "\n"; } return result; } }