Here you can find the source of camelToSnake(final String camelStr)
public static String camelToSnake(final String camelStr)
//package com.java2s; //License from project: Open Source License public class Main { public static String camelToSnake(final String camelStr) { String ret = camelStr.replaceAll("([A-Z]+)([A-Z][a-z])", "$1_$2").replaceAll("([a-z])([A-Z])", "$1_$2"); return ret.toLowerCase(); }//from w ww . j a v a 2 s.co m }