Java tutorial
//package com.java2s; public class Main { public static String fieldToParams(String fieldName) { for (char a : fieldName.toCharArray()) { if (a >= 65 && a <= 90) { fieldName = fieldName.replaceFirst(String.valueOf(a), "_" + a); } } fieldName = fieldName.toUpperCase(); return fieldName; } }