Here you can find the source of toCamelCase(String s, boolean firstCharUppercase)
public static String toCamelCase(String s, boolean firstCharUppercase)
//package com.java2s; //License from project: Open Source License public class Main { public static String toCamelCase(String s, boolean firstCharUppercase) { char[] cl = s.toCharArray(); StringBuffer sb = new StringBuffer(); boolean upper = firstCharUppercase; for (char ch : cl) { switch (ch) { case '_': case '?': case ';': // add anything to escape upper = true;//from www . ja va 2s .com break; default: sb.append((char) (upper ? (ch >= 'a' && ch <= 'z' ? ch - 'a' + 'A' : ch) : ch)); upper = false; } } return sb.toString(); } public static String toCamelCase(String s) { if (s.toLowerCase().equals("id")) return "Id"; return toCamelCase(s, true); } }