Why can’t printf be formatted with an array of ints?
<p>I want to format an output string with a series of variables. When I use an array of strings, this works as expected:</p>

<pre><code>String[] myArray = new String[3];
// fill array with strings
System.out.printf("1: %s \n2: %s \n3: %s\n", myArray);
</code></pre>

<p>I want to use this to print the results of simulated dice-throws, so I use an array of ints. However, this doesn’t work:</p>

<pre><code>int[] myArray = new int[3];
// fill array with numbers
System.out.printf("1: %d \n2: %d \n3: %d\n", myArray);
Exception in thread "main" java.util.IllegalFormatConversionException: d != [I
</code></pre>

<p>Of course, I could use <code>myArray[0]</code> etc. for every element, but this doesn’t seem very elegant.</p>

<p>Why is this so and how can I achieve the desired result?</p>
