Here you can find the source of format(final String message, final Object... args)
public static String format(final String message, final Object... args)
//package com.java2s; //License from project: Apache License import java.util.Arrays; public class Main { public static String format(final String message, final Object... args) { try {//from w ww. ja v a2 s .c o m for (int i = 0; i < args.length; i++) { final Object o = args[i]; if (o != null && o.getClass().isArray()) { args[i] = Arrays.asList((Object[]) o); } } return String.format(message, args); } catch (final Exception e) { final String error = buildExceptionMessage(message, e, args); return error; } } private static String buildExceptionMessage(final String message, final Exception e, final Object... args) { String error = "Could not format message with format string: {" + message + "}, args: {"; final boolean useComma = false; for (final Object arg : args) { if (useComma) { error += ", "; } error += "{" + (arg != null ? arg : "null") + "}"; } return error; } }