Here you can find the source of toList(int[] a)
public final static List<Integer> toList(int[] a)
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { public final static List<Integer> toList(int[] a) { if (a == null) return null; List<Integer> li = new ArrayList<Integer>(a.length); for (int i = 0; i < a.length; i++) { li.add(a[i]);//from ww w .j a va 2 s. c o m } return li; } public final static List<String> toList(String[] a) { if (a == null) return null; List<String> li = new ArrayList<String>(a.length); for (int i = 0; i < a.length; i++) { li.add(a[i]); } return li; } }