Here you can find the source of capitalize(String input)
public static String capitalize(String input)
//package com.java2s; //License from project: Open Source License public class Main { public static String capitalize(String input) { int length; if (input == null || (length = input.length()) == 0) { return ""; } else if (length > 1) { return input.substring(0, 1).toUpperCase().concat(input.substring(1)); } else {/*from w ww .j a v a2 s . c om*/ return input.toUpperCase(); } } }