public static String formatColumnName(String columnName) {
        if (columnName.length() < 3) return columnName;

        StringBuffer buffer = new StringBuffer(columnName);
        boolean isPreviousLowerCase = false;

        for (int i = 1; i < buffer.length(); i++) {
            boolean isCurrentUpperCase = Character.isUpperCase(buffer.charAt(i));

            if (isCurrentUpperCase && isPreviousLowerCase) {
                buffer.insert(i, " ");
                i++;
            }

            isPreviousLowerCase = !isCurrentUpperCase;
        }

        return buffer.toString().replaceAll("_", " ");
    }