public class TriangleUtilities { public static String getRow(int numberOfStars) { StringBuilder builder = new StringBuilder(); for(int i=1; i<=numberOfStars; i++){ builder.append('*'); } return builder.toString(); } public static String getTriangle(int numberOfRows) { StringBuilder builder = new StringBuilder(); for(int i=1; i<=numberOfRows; i++){ String x = getRow(i); builder.append(x + "\n"); } return builder.toString(); } public static String getSmallTriangle() { StringBuilder builder = new StringBuilder(); for(int i=1; i<=4; i++){ String x = getRow(i); builder.append(x + "\n"); } return builder.toString(); } public static String getLargeTriangle() { StringBuilder builder = new StringBuilder(); for(int i=1; i<=9; i++){ String x = getRow(i); builder.append(x + "\n"); } return builder.toString(); } }