Here you can find the source of capitalizePackageName(final String packageName)
public static String capitalizePackageName(final String packageName)
//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 capitalizePackageName(final String packageName) { String s = packageName;/*from w ww .j a va2 s. co m*/ if (packageName != null) { String[] ss = packageName.replaceAll("-", ".").split("\\."); StringBuffer sb = new StringBuffer(packageName.length()); for (String sx : ss) { if (sx.length() > 0) { sb.append(sx.substring(0, 1).toUpperCase()); if (sx.length() > 1) { sb.append(sx.substring(1, sx.length())); } } } s = sb.toString(); } return s; } }