Here you can find the source of enumsToString(EnumSet
public static <ENUM extends Enum<ENUM>> String enumsToString(EnumSet<ENUM> elems)
//package com.java2s; //License from project: Apache License import java.util.EnumSet; public class Main { public static <ENUM extends Enum<ENUM>> String enumsToString(EnumSet<ENUM> elems) { if (elems != null) { StringBuilder buf = new StringBuilder(); for (ENUM e : elems) { if (buf.length() > 0) { buf.append(","); }/*ww w . ja v a2s. c o m*/ buf.append(e.name()); } return buf.toString(); } else { return null; } } }