class BusinessRejectReasonText extends BusinessRejectReason {

    static String toText(String constName) {
        StringBuilder sb = new StringBuilder(constName.toLowerCase());
        boolean upper = true; // first character is upper
        for (int i = 0; i < sb.length(); i++) {
            if (upper) {
                sb.setCharAt(i, Character.toUpperCase(sb.charAt(i)));
                upper = false;
            }
            if (sb.charAt(i) == '_') {
                sb.setCharAt(i, ' ');
                upper = true; // character after space is upper
            }
        }
        return sb.toString();
    }

}