코드가 하는 일을 읽고, 가려진 빈칸에 직접 이름을 지어 넣으세요. 빈칸 폭이 원본 이름의 글자 수입니다.
1public static String ( 2 @Nullable String template, @Nullable Object @Nullable ... args) { 3 template = String.valueOf(template); 4 5 if (args == null) { 6 args = new Object[] {"(Object[])null"}; 7 } 8 9 StringBuilder builder = new StringBuilder(template.length() + 16 * args.length); 10 int templateStart = 0; 11 int i = 0; 12 while (i < args.length) { 13 int placeholderStart = template.indexOf("%s", templateStart); 14 if (placeholderStart == -1) { 15 break; 16 } 17 builder.append(template, templateStart, placeholderStart); 18 builder.append(lenientToString(args[i++])); 19 templateStart = placeholderStart + 2; 20 } 21 builder.append(template, templateStart, template.length()); 22 23 if (i < args.length) { 24 String prefix = " ["; 25 for (; i < args.length; i++) { 26 builder.append(prefix); 27 builder.append(lenientToString(args[i])); 28 prefix = ", "; 29 } 30 builder.append(']'); 31 } 32 33 return builder.toString(); 34}