Here you can find the source of capitalize(String str)
public static String capitalize(String str)
//package com.java2s; public class Main { public static String capitalize(String str) { String capitalized = str; if (str == null || str.isEmpty()) { return capitalized; }/*from w ww .j a v a 2s . co m*/ capitalized = String.valueOf(str.charAt(0)).toUpperCase() + str.substring(1); return capitalized; } }