Here you can find the source of toStringArray(int[] nums)
public static String[] toStringArray(int[] nums)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static String[] toStringArray(int[] nums) { if (nums == null) { return null; }/* w w w .j av a2 s . c o m*/ String[] fields = new String[nums.length]; int index = 0; for (Integer num : nums) { fields[index] = Integer.toString(num); index++; } return fields; } public static String[] toStringArray(List<Integer> list) { if (isEmpty(list)) { return null; } 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(long[] 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(); } } }