Here you can find the source of toCamelCase(final String string)
public static String toCamelCase(final String string)
//package com.java2s; //License from project: Apache License public class Main { public static String toCamelCase(final String string) { final char[] chars = string.toCharArray(); for (int i = 0; i < chars.length; i++) { final char c = chars[i]; if (Character.isUpperCase(c)) { // If we have moved beyond the first character, aren't yet at // the end and the next character is lower case then this must // be the first capital of the next word so don't lower case and // stop any further modification. if (i > 0 && i < chars.length - 1 && Character.isLowerCase(chars[i + 1])) { break; } else { chars[i] = Character.toLowerCase(c); }/*from w w w . j a v a 2 s.co m*/ } else { break; } } return new String(chars); } }