Here you can find the source of capitalize(final String name)
public static String capitalize(final String name)
//package com.java2s; /******************************************************************************* * Copyright (c) 2013, 2014, 2015 QPark Consulting S.a r.l. This program and the * accompanying materials are made available under the terms of the Eclipse * Public License v1.0. The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html. ******************************************************************************/ public class Main { public static String capitalize(final String name) { String s = name;// w w w . ja v a 2 s. c o m if (s != null && s.length() > 0) { StringBuffer sb = new StringBuffer(s.length()); sb.append(s.substring(0, 1).toUpperCase()); if (s.length() > 1) { sb.append(s.substring(1, s.length())); } s = sb.toString(); } return s; } }