title: Java: invoke Object vararg method with an int array
body: <p>have a method with the following signature:</p>
  
  <pre><code>public static String concatAndSeperate(Object seperator, Object... obj)
  </code></pre>
  
  <p>The purpose of the method is to concat the objects in obj with a seperator in between the entries of obj.</p>
  
  <p>Now I have an int array that I cannot modify due to heavy side effects.</p>
  
  <pre><code>int[] numbers = new int[] {1, 2, 3, 4, 5, 6, 7};
  </code></pre>
  
  <p>I want to use those numbers for an SQL IN statement:</p>
  
  <pre><code>SELECT * FROM quux WHERE id IN (1, 2, 3, 4, 5, 6, 7);
  </code></pre>
  
  <p>So I try to concat it with my nice little method:</p>
  
  <pre><code>concatAndSeperate(", ", numbers);
  </code></pre>
  
  <p>This doesn't work, of course, since numbers is an integer array and not an Integer array. So I try to make an Integer array out of it:</p>
  
  <pre><code>concatAndSeperate(", ", Arrays.asList(numbers).toArray(new Integer[numbers.length]);
  </code></pre>
  
  <p>This causes a nice error I do not understand:</p>
  
  <pre><code>Exception in thread "main" java.lang.ArrayStoreException
  at java.lang.System.arraycopy(Native Method)
  at java.util.Arrays.copyOf(Unknown Source)
  at java.util.Arrays$ArrayList.toArray(Unknown Source)
  at mystuff.MyClass.main(MyClass.java:415)
  </code></pre>