Here you can find the source of underscoresToCamelCaseImpl(String input, boolean capNextLetter)
public static String underscoresToCamelCaseImpl(String input, boolean capNextLetter)
//package com.java2s; //License from project: Apache License public class Main { public static String underscoresToCamelCaseImpl(String input, boolean capNextLetter) { StringBuilder result = new StringBuilder(); char[] chars = input.toCharArray(); for (int i = 0; i < chars.length; ++i) { if ('a' <= chars[i] && chars[i] <= 'z') { if (capNextLetter) { result.append((char) (chars[i] + ('A' - 'a'))); } else { result.append(chars[i]); }//from w w w. j a v a2 s. c o m capNextLetter = false; } else if ('A' <= chars[i] && chars[i] <= 'Z') { if (i == 0 && !capNextLetter) { // Force first letter to lower-case unless explicitly told to // capitalize it. result.append((char) (chars[i] + ('a' - 'A'))); } else { // Capital letters after the first are left as-is. result.append(chars[i]); } capNextLetter = false; } } return result.toString(); } }