Here you can find the source of capitalize(final String str)
public static String capitalize(final String str)
//package com.java2s; /*//w ww.j a v a 2 s . c o m License: blueprint-sdk is licensed under the terms of Eclipse Public License(EPL) v1.0 (http://www.eclipse.org/legal/epl-v10.html) Distribution: Repository - https://github.com/lempel/blueprint-sdk.git Blog - http://lempel.egloos.com */ public class Main { public static String capitalize(final String str) { String result = null; if (str != null) { if (str.length() >= 2) { result = str.substring(0, 1).toUpperCase() + str.substring(1).toLowerCase(); } else { result = str.toUpperCase(); } } return result; } }