Here you can find the source of capitalize(String text)
public static String capitalize(String text)
//package com.java2s; //License from project: Apache License public class Main { public static String capitalize(String text) { if (text == null) { return null; }/* www.j a v a2 s . c o m*/ int length = text.length(); if (length == 0) { return text; } String answer = text.substring(0, 1).toUpperCase(); if (length > 1) { answer += text.substring(1, length); } return answer; } }