/** * Test 1 utility class that provides fields and methods for working with * strings. * */ public class TestH { /** * The empty string "" */ public static final String EMPTY = ""; /** * The char equal to a single space. */ public static final char CHAR_SPACE = ' '; /** * Return a string of length n where all of the characters in the string are * equal to TestH.CHAR_SPACE * * @param n * the length of the desired string * @pre. n >= 0 * @return a string made up of TestH.CHAR_SPACE repeated n times */ public static String allSpaces(int n) { StringBuilder b = new StringBuilder(); for (int i = 0; i < n; i++) { b.append(TestH.CHAR_SPACE); } return b.toString(); } private TestH() { } }