public static void printSnakeListToJavaVar(List<String> snakeList) { for (String columnName : snakeList) { columnName = columnName.trim(); System.out.println("@Column(name=\"" + columnName + "\")"); System.out.println("String " + snakeToJavaVar(columnName.toLowerCase()) + ";"); } } public static String snakeToJavaVar(String str) { // Capitalize first letter of string str = str.substring(0, 1).toLowerCase() + str.substring(1); // Run a loop till string return capitalizeFirstCharAfterDelimiter(str, "_"); } private static String capitalizeFirstCharAfterDelimiter(String str, String deLimiter) { // string contains delimiter while (str.matches(".*" + deLimiter + ".*")) { str = str.replaceFirst( deLimiter + "[a-z]", String.valueOf( Character.toUpperCase( str.charAt( str.indexOf(deLimiter) + 1)))); } return str; }