Here you can find the source of toStrings(Class> clenum)
static public String[] toStrings(Class<?> clenum)
//package com.java2s; //License from project: GNU General Public License import java.util.HashMap; import java.util.Map; public class Main { static private final Map<Class<?>, String[]> strings = new HashMap<Class<?>, String[]>(); static public String[] toStrings(Class<?> clenum) { synchronized (strings) { String[] result = strings.get(clenum); if (result == null) { try { Enum<?>[] values = (Enum<?>[]) clenum.getMethod("values").invoke(null); result = new String[values.length]; for (int i = 0; i < values.length; i++) { result[i] = values[i].toString(); }/*from w w w. j a va 2s . c o m*/ } catch (Exception e) { result = new String[] { "EnumUtils.toStrings failure" }; } strings.put(clenum, result); } return result; } } }