Source:
<code>public String getQuestionResultStatisticsCsv( List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question, FeedbackSessionResultsBundle bundle) { if (responses.isEmpty()) { return ""; } StringBuilder csv = new StringBuilder(); DecimalFormat dfWeight = new DecimalFormat("#.##"); for (int i = 0; i < rubricChoices.size(); i++) { String header = rubricChoices.get(i) + (hasAssignedWeights ? " (Weight: " + dfWeight.format(rubricWeights.get(i)) + ")" : ""); csv.append(',').append(Sanitizer.sanitizeForCsv(header)); } if (hasAssignedWeights) { csv.append(",Average"); } csv.append(Const.EOL); DecimalFormat df = new DecimalFormat("#"); DecimalFormat dfAverage = new DecimalFormat("0.00"); int[][] responseFrequency = calculateResponseFrequency(responses, this); float[][] rubricStats = calculateRubricStats(responses, this); for (int i = 0; i < rubricSubQuestions.size(); i++) { String alphabeticalIndex = StringHelper.integerToLowerCaseAlphabeticalIndex(i + 1); csv.append(Sanitizer.sanitizeForCsv(alphabeticalIndex + ") " + rubricSubQuestions.get(i))); boolean isSubQuestionRespondedTo = responseFrequency[i][numOfRubricChoices] > 0; for (int j = 0; j < rubricChoices.size(); j++) { <START> String percentageFrequency = isSubQuestionRespondedTo <END> ? df.format(rubricStats[i][j] * 100) + "%" : STATISTICS_NO_VALUE_STRING; csv.append("," + percentageFrequency + " (" + responseFrequency[i][j] + ")"); } if (hasAssignedWeights) { String value = isSubQuestionRespondedTo ? dfAverage.format(rubricStats[i][rubricWeights.size()]) : STATISTICS_NO_VALUE_STRING; csv.append(',').append(value); } csv.append(Const.EOL); } return csv.toString(); }</code><technical_language>Do rename this percentageFrequencyString for consistency</technical_language>

Target:
public String getQuestionResultStatisticsCsv( List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question, FeedbackSessionResultsBundle bundle) { if (responses.isEmpty()) { return ""; } StringBuilder csv = new StringBuilder(); DecimalFormat dfWeight = new DecimalFormat("#.##"); for (int i = 0; i < rubricChoices.size(); i++) { String header = rubricChoices.get(i) + (hasAssignedWeights ? " (Weight: " + dfWeight.format(rubricWeights.get(i)) + ")" : ""); csv.append(',').append(Sanitizer.sanitizeForCsv(header)); } if (hasAssignedWeights) { csv.append(",Average"); } csv.append(Const.EOL); DecimalFormat df = new DecimalFormat("#"); DecimalFormat dfAverage = new DecimalFormat("0.00"); int[][] responseFrequency = calculateResponseFrequency(responses, this); float[][] rubricStats = calculateRubricStats(responses, this); for (int i = 0; i < rubricSubQuestions.size(); i++) { String alphabeticalIndex = StringHelper.integerToLowerCaseAlphabeticalIndex(i + 1); csv.append(Sanitizer.sanitizeForCsv(alphabeticalIndex + ") " + rubricSubQuestions.get(i))); boolean isSubQuestionRespondedTo = responseFrequency[i][numOfRubricChoices] > 0; for (int j = 0; j < rubricChoices.size(); j++) { String percentageFrequencyString = isSubQuestionRespondedTo ? df.format(rubricStats[i][j] * 100) + "%" : STATISTICS_NO_VALUE_STRING; csv.append("," + percentageFrequencyString + " (" + responseFrequency[i][j] + ")"); } if (hasAssignedWeights) { String averageString = isSubQuestionRespondedTo ? dfAverage.format(rubricStats[i][rubricWeights.size()]) : STATISTICS_NO_VALUE_STRING; csv.append(',').append(averageString); } csv.append(Const.EOL); } return csv.toString(); }