title: How do I pass generic type for java.lang.reflect.Array.newInstance?
body: <p>My code snippet.</p>
  
  <pre><code>public class GenericArray &lt;T extends Comparable&lt;T&gt;&gt;{
     private T[] a;
     private int nElems;
     public  GenericArray(int max) // constructor
     {
         a=(T[])java.lang.reflect.Array.newInstance(Integer.class, max); 
         //Hard coded for Integer.
     }
  }
  
  GenericArray arr= new GenericArray&lt;Integer&gt;(100); 
  </code></pre>
  
  <p>This works, As I am instantiating explicitly passing Integer.class. How do I make this as generic ?  </p>
  
  <p>Or 
  Is there a way to print Type information which passed to GenericArray using ParameterizedType ? (If I get that probably, I would handle using if statements)</p>