Here you can find the source of deCamelCap(String s)
public static String deCamelCap(String s)
//package com.java2s; //License from project: LGPL public class Main { public static String deCamelCap(String s) { if (s.length() == 0) return s; return Character.toUpperCase(s.charAt(0)) + deCamel(s.substring(1)); }//from w ww. j a v a2 s . com public static String deCamel(String s) { if (s.length() < 2) return s; StringBuilder sb = new StringBuilder(); sb.append(s.charAt(0)); for (int i = 0; i < s.length() - 2; i++) { boolean[] c = new boolean[] { Character.isUpperCase(s.charAt(i)), Character.isUpperCase(s.charAt(i + 1)), Character.isUpperCase(s.charAt(i + 2)) }; if (c[1] && !(c[0] && c[2])) sb.append(' '); sb.append((c[1] && !c[2]) ? Character.toLowerCase(s.charAt(i + 1)) : s.charAt(i + 1)); } return sb.append(s.charAt(s.length() - 1)).toString(); } }