Here you can find the source of toCamelCase(String s)
public static String toCamelCase(String s)
//package com.java2s; public class Main { public static String toCamelCase(String s) { if (s == null) return null; if (s.isEmpty() || !Character.isLetter(s.codePointAt(0))) return s; char prefix = s.charAt(0); prefix = Character.toUpperCase(prefix); String suffix = s.substring(1); // check to see if suffix has lower case letters, in which case it is // assumed to already be camel case. for (int i = 0; i < suffix.length(); ++i) { char c = suffix.charAt(i); if (Character.isLowerCase(c)) { suffix = suffix.toLowerCase(); break; }/*ww w. j av a 2 s. c om*/ } return prefix + suffix; } }