Here you can find the source of capitalize(String message)
public static String capitalize(String message)
//package com.java2s; //License from project: Open Source License public class Main { /** Capitalize the first word and trim whitespaces. */ public static String capitalize(String message) { message = message.trim();//from w w w. j av a 2 s . c o m if (message.equals("")) return message; StringBuilder buffer = new StringBuilder(message); char first = buffer.charAt(0); if (!Character.isUpperCase(first)) buffer.setCharAt(0, Character.toUpperCase(first)); return buffer.toString(); } }