title: Convert from List<Integer> to array float[]
body: <p>I have a list as follow:</p>
  
  <pre><code>List&lt;Integer&gt; arrInt={2,3,5};
  </code></pre>
  
  <p>I want to convert this arraylist to array float.</p>
  
  <pre><code>float[] result={2,3,5};
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>    public float[] convertIntToFloat(List&lt;Integer&gt; arr)
      {
        List&lt;Float&gt; arrResult=new ArrayList&lt;Float&gt;();
  
        for(int i=0;i&lt;arr.size();i++)
        {
          float x=i;
          arrResult.add(x);
        }
  
        float result[]=arrResult.toArray( new float[arr.size()]);  //Error
  
        return result;
      }
  </code></pre>
  
  <p>But it display error in my code as above.
  Can you help me?</p>