Here you can find the source of toCamelCase(final String init)
public static String toCamelCase(final String init)
//package com.java2s; //License from project: Apache License public class Main { public static String toCamelCase(final String init) { if (init == null) return null; final StringBuilder ret = new StringBuilder(init.length()); for (final String word : init.split("_")) { if (!word.isEmpty()) { if (word.equalsIgnoreCase("DW")) { ret.append("DW"); } else { ret.append(word.substring(0, 1).toUpperCase()); ret.append(word.substring(1).toLowerCase()); }//from w ww .j av a 2s .c o m } if (!(ret.length() == init.length())) ret.append("_"); } return ret.toString(); } }