Here you can find the source of capitalizeFirst(String toCapitalize)
public static String capitalizeFirst(String toCapitalize)
//package com.java2s; //License from project: Open Source License public class Main { /**//www .j a v a2 s .c om * Make first character of String uppercase, and the * rest lowercase. */ public static String capitalizeFirst(String toCapitalize) { if (toCapitalize.length() > 1) { return toCapitalize.substring(0, 1).toUpperCase() + toCapitalize.substring(1, toCapitalize.length()).toLowerCase(); } else { return toCapitalize.toUpperCase(); } } }