Here you can find the source of format(String s)
public static String format(String s)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { public static String format(String s) { String[] fullNameSplit = s.split("_| "); List<String> fullNameList = new ArrayList<String>(); for (String f : fullNameSplit) { fullNameList.add(f);//w w w . j a v a 2 s . c om } String name = ""; for (String f : fullNameList) { name = name + f.replace(f.substring(1), f.substring(1).toLowerCase()); name = name + " "; } name = name.trim(); return name; } }