int someNumber = 42; String someString = "foobar"; Object[] args = {new Long(someNumber), someString}; MessageFormat fmt = new MessageFormat("String is "{1}", number is {0}."); System.out.println(fmt.format(args));