public class TriangleUtilities { public static String getRow(int numberOfStars) { int counter = 1; String triangle = ""; String add = "*"; for (int i = 1; i <= numberOfStars; i++){ triangle = triangle + add; } return triangle; } public static String getTriangle(int numberOfRows) { int counter = 1; String triangle = ""; String add = "*"; for (int i = 1; i <= numberOfRows; i++){ for (int y = 1; y <= counter; y++){ triangle = triangle + add; } counter++; triangle = triangle + System.getProperty("line.separator"); } return triangle; } public static String getSmallTriangle() { int width = 4; int counter = 1; String triangle = ""; String add = "*"; for (int i = 1; i <= width; i++){ for (int y = 1; y <= counter; y++){ triangle = triangle + add; } counter++; triangle = triangle + System.getProperty("line.separator"); } return triangle; } public static String getLargeTriangle() { int width = 9; int counter = 1; String triangle = ""; String add = "*"; for (int i = 1; i <= width; i++){ for (int y = 1; y <= counter; y++){ triangle = triangle + add; } counter++; triangle = triangle + System.getProperty("line.separator"); } return triangle; } }