Here you can find the source of classNameToConstant(String className)
public static String classNameToConstant(String className)
//package com.java2s; //License from project: Open Source License public class Main { public static String classNameToConstant(String className) { return camelCaseNameToConstant(className); }/*from w w w . j a v a2 s . c o m*/ private static String camelCaseNameToConstant(String camelCaseName) { if (camelCaseName == null || camelCaseName.isEmpty()) { return camelCaseName; } return camelCaseName.replaceAll("([a-z]{1})([A-Z]{1})", "$1_$2").toUpperCase(); } }