Here you can find the source of capitalize(String s)
public static String capitalize(String s)
//package com.java2s; //License from project: Apache License public class Main { public static String capitalize(String s) { char ch[]; ch = s.toCharArray();// w ww. j a v a 2 s . c om if (ch[0] >= 'a' && ch[0] <= 'z') { ch[0] = (char) (ch[0] - 32); } String newString = new String(ch); return newString; } }