Here you can find the source of toStringArray(List
public static String[] toStringArray(List<Integer> list)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static String[] toStringArray(List<Integer> list) { if (isEmpty(list)) { return null; }/*from w w w .j a va 2s . com*/ String[] fields = new String[list.size()]; int index = 0; for (Integer num : list) { fields[index] = Integer.toString(num); index++; } return fields; } public static boolean isEmpty(List<?> list) { if (list == null || list.isEmpty()) { return true; } else { return false; } } public static int size(Object[] list) { if (list == null) { return 0; } else { return list.length; } } public static int size(List<?> list) { if (list == null) { return 0; } else { return list.size(); } } }