title: Add element to Array by converting Array to List, adding the element and converting it back again
body: <p>I need to add en int element to an array.</p>
  
  <p>I thought about convering the array to an arrayList, addind the int and then converting the arrayList into an array again.</p>
  
  <p>As expected, I failed completely.</p>
  
  <p>aGrades is an array, lGrades is an ArrayList</p>
  
  <pre><code>// add one grade from 1-5
      public void enter (int grade){
      ArrayList&lt;Integer&gt; lGrades = new ArrayList&lt;Integer&gt;(Arrays.asList(aGrades));
      lGrades.add(grade);
      aGrades = listArray.toArray(lGrades);
    }
  </code></pre>
  
  <p>The error right now is:</p>
  
  <pre><code>Histo.java:28: error: no suitable constructor found for ArrayList(List&lt;int[]&gt;)
      ArrayList&lt;Integer&gt; lGrades = new ArrayList&lt;Integer&gt;(Arrays.asList(aGrades));
                                   ^
  constructor ArrayList.ArrayList(Collection&lt;? extends Integer&gt;) is not applicable
    (actual argument List&lt;int[]&gt; cannot be converted to Collection&lt;? extends Integer&gt; by method invocation conversion)
  constructor ArrayList.ArrayList() is not applicable
    (actual and formal argument lists differ in length)
  constructor ArrayList.ArrayList(int) is not applicable
    (actual argument List&lt;int[]&gt; cannot be converted to int by method invocation conversion)
  Histo.java:30: error: incompatible types
      aGrades = lGrades.toArray(new Integer[lGrades.size()]);
                               ^
    required: int[]
    found:    Integer[]
  </code></pre>
  
  <p>This is probably a complete mess, but I have searched through many threads about this and am very confused by now.</p>
  
  <p>Thanks a lot!</p>