Here you can find the source of camelCaseToUnderscores(String camel)
public static String camelCaseToUnderscores(String camel)
//package com.java2s; //License from project: Open Source License public class Main { public static String camelCaseToUnderscores(String camel) { String underscore;/*from w w w . ja v a 2 s. c o m*/ underscore = String.valueOf(Character.toLowerCase(camel.charAt(0))); for (int i = 1; i < camel.length(); i++) { underscore += Character.isLowerCase(camel.charAt(i)) ? String .valueOf(camel.charAt(i)) : "_" + String.valueOf(Character.toLowerCase(camel .charAt(i))); } return underscore; } }