Here you can find the source of className(String underScore)
public static String className(String underScore)
//package com.java2s; //License from project: Apache License public class Main { public static String className(String underScore) { String name = fieldName(underScore); return Character.toUpperCase(name.charAt(0)) + name.substring(1); }//from www . j a va 2s. c o m public static String fieldName(String underScore) { StringBuilder name = new StringBuilder(); underScore = underScore.toLowerCase(); boolean isUnderScore = false; for (int i = 0; i < underScore.length(); i++) { char spell = underScore.charAt(i); if (isUnderScore) { name.append(Character.toUpperCase(spell)); isUnderScore = false; } else { if (spell == '_') { isUnderScore = true; } else { name.append(spell); } } } return name.toString(); } }