Here you can find the source of toCamelCase(String text, boolean capFirstLetter)
public static String toCamelCase(String text, boolean capFirstLetter)
//package com.java2s; //License from project: Open Source License public class Main { public static String toCamelCase(String text, boolean capFirstLetter) { String[] parts = text.split("[_]"); StringBuilder buf = new StringBuilder(); for (int i = 0; i < parts.length; i++) { String lc = parts[i].toLowerCase(); if (i > 0 || capFirstLetter) { buf.append(Character.toUpperCase(lc.charAt(0))); buf.append(lc.substring(1)); } else { buf.append(lc);//w ww . ja va 2 s. co m } } return buf.toString(); } }