Here you can find the source of arrayToList(int[] a)
public static ArrayList<Integer> arrayToList(int[] a)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { /**//from w w w . j a v a 2 s . c o m * make an Array of the type int[] into ArrayList<Integer>. We need this * because there is no autoboxing between Integer and int types hence * Arrays.aslist cannot be used for this conversion */ public static ArrayList<Integer> arrayToList(int[] a) { ArrayList<Integer> ret = new ArrayList<Integer>(); for (int i = 0; i < a.length; i++) { ret.add(a[i]); } return ret; } }