Here you can find the source of camelCaseToUnderscore(String camelCased)
static String camelCaseToUnderscore(String camelCased)
//package com.java2s; //License from project: Apache License public class Main { static String camelCaseToUnderscore(String camelCased) { // guava has best solution for this with CaseFormat class // but don't want to add dependency just for this method final String regex = "([a-z])([A-Z]+)"; final String replacement = "$1_$2"; return camelCased.replaceAll(regex, replacement); }//from w ww . jav a 2s . co m }