Returns a string containing the supplied int values separated by separator. For example, join("-", 1, 2, 3) returns the string "1-2-3". @param separator the text that should appear between consecutive values in the resulting string (but not at the start or end) @
(String separator, int... array)
| 421 | |
| 422 | |
| 423 | public static String join(String separator, int... array) { |
| 424 | checkNotNull(separator); |
| 425 | if (array.length == 0) { |
| 426 | return ""; |
| 427 | } |
| 428 | |
| 429 | // For pre-sizing a builder, just get the right order of magnitude |
| 430 | StringBuilder builder = new StringBuilder(array.length * 5); |
| 431 | builder.append(array[0]); |
| 432 | for (int i = 1; i < array.length; i++) { |
| 433 | builder.append(separator).append(array[i]); |
| 434 | } |
| 435 | return builder.toString(); |
| 436 | } |
| 437 | |
| 438 | /** |
| 439 | * Returns a comparator that compares two {@code int} arrays <a |
no test coverage detected