How to get the initialisation value for a Java Class reference : <p>I have a <code>Class&lt;?&gt;</code> reference for an arbitrary type. How to get that type's initialisation value? Is there some library method for this or do I have to roll my own, such as:</p>

<pre><code>Class&lt;?&gt; klass = ...
Object init = 
    (klass == boolean.class)
  ? false
  : (klass == byte.class)
  ? (byte) 0
  ...
  : (Object) null;
</code></pre>

<p>The use case is I have an arbitrary <code>java.lang.reflect.Method</code> reference, which I want to call using arbitrary parameters (for some testing), which may not be <code>null</code> in case the parameter is a primitive type, so I need to specify some value of that type.</p>
