title: Exception in thread "main" java.lang.ClassCastException: [I cannot be cast to java.lang.Integer
body: <pre><code>List&lt;Integer&gt; P = new ArrayList(Arrays.asList(p)); // Copies array p into Arraylist P
  P.sort(null);
  List&lt;Integer&gt; kk = new ArrayList();
  kk.set(0, P.get(0)+k); //Exception generated on this line
  </code></pre>
  
  <p>I do not know why I'm unable to set it that way. Can anyone please help me on this?
  Thanks.</p>