Here you can find the source of titleCasedName(T instance)
public static <T extends Enum<T>> String titleCasedName(T instance)
//package com.java2s; /*//from w ww . ja v a2 s.co m * Copyright Northwestern University and SemanticBits, LLC * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/ctms-commons/LICENSE.txt for details. */ public class Main { public static <T extends Enum<T>> String titleCasedName(T instance) { StringBuilder name = new StringBuilder(instance.name().toLowerCase()); name.setCharAt(0, Character.toUpperCase(name.charAt(0))); for (int i = 0; i < name.length(); i++) { if (name.charAt(i) == '_') { name.setCharAt(i, ' '); name.setCharAt(i + 1, Character.toUpperCase(name.charAt(i + 1))); } } return name.toString(); } }