How to convert an Object[] type to Userdefined array type
<p>I am creating the Leg Objects this way </p>

<pre><code>List&lt;Leg&gt; legs = new ArrayList&lt;Leg&gt;(legdata.length);
</code></pre>

<p>I need to pass this legs to an method with the below signature as shown :</p>

<pre><code> public static String getStrategy(Leg[] leg)
</code></pre>

<p>when i did the below way i am getting an error .</p>

<pre><code>String resultData = CMPUtil.getStrategy(legs.toArray());
</code></pre>

<p>Also tried this way </p>

<pre><code>Leg les[] = (Leg)legs.toArray();  ( It says cannot cast from Object to Leg)
</code></pre>

<p>could anybody please let me know , how to resolve this ??</p>
