create generic array of a specific length
<p>I need to create a generic array of a specific length.</p>

<p>I have the generic array T[] originalArray and in some point in my code I will copy originalArray to a new array so I need to do something like:</p>

<pre><code>T[] newArray = new T[originalArray.length()];
</code></pre>

<p>I've read that I cannot do this in Java but I cannot come up with a solution. Any ideas please?</p>
