title: Converting an array of objects to an array of their primitive types
body: <p>If you have an array of Java objects which have a primitive type (for example Byte, Integer, Char, etc).  Is there a neat way I can convert it into an array of the primitive type?  In particular can this be done without having to create a new array and loop through the contents.</p>
  
  <p>So for example, given</p>
  
  <pre><code>Integer[] array
  </code></pre>
  
  <p>what is the neatest way to convert this into</p>
  
  <pre><code>int[] intArray
  </code></pre>
  
  <p>Unfortunately, this is something we have to do quite frequently when interfacing between Hibernate and some third party libraries over which we have no control.  It seems this would be a quite common operation so I would be surprised if there's no shortcut.</p>
  
  <p>Thanks for your help!</p>