Source:
<code>public static Optional<InsightCard> processData(final Long accountId, final List<DeviceData> data, final Optional<Device.Color> colorOptional, final Optional<Calibration> calibrationOptional, final TemperatureUnit tempUnit) { if (data.isEmpty()) { return Optional.absent(); } final Device.Color color = colorOptional.or(Device.DEFAULT_COLOR); final DescriptiveStatistics stats = new DescriptiveStatistics(); for (final DeviceData deviceData : data) { final CalibratedDeviceData calibratedDeviceData = new CalibratedDeviceData(deviceData, color, calibrationOptional); stats.addValue(calibratedDeviceData.temperature()); stats.addValue(DataUtils.calibrateTemperature(deviceData.ambientTemperature)); } <START> final double tmpMedValue = stats.getPercentile(50); <END> final int medTempC = (int) tmpMedValue; final int medTempF = DataUtils.celsiusToFahrenheit(medTempC); LOGGER.debug("Temp for account {}: med C; F", accountId, medTempC, medTempF); int medTemp = medTempC; int idealMin = IDEAL_TEMP_MIN_CELSIUS; int idealMax = IDEAL_TEMP_MAX_CELSIUS; if (tempUnit == TemperatureUnit.FAHRENHEIT) { medTemp = medTempF; idealMin = IDEAL_TEMP_MIN; idealMax = IDEAL_TEMP_MAX; } Text text; if (medTemp >= idealMin && medTemp <= idealMax) { text = TemperatureMsgEN.getTempMsgPerfect(medTemp, tempUnit.toString()); } else if (medTemp < idealMin) { text = TemperatureMsgEN.getTempMsgTooCold(medTemp, tempUnit.toString(), idealMin); } else { text = TemperatureMsgEN.getTempMsgTooHot(medTemp, tempUnit.toString(), idealMax); } return Optional.of(InsightCard.createBasicInsightCard(accountId, text.title, text.message, InsightCard.Category.TEMPERATURE, InsightCard.TimePeriod.RECENTLY, DateTime.now(DateTimeZone.UTC), InsightCard.InsightType.DEFAULT)); }</code><technical_language>need create addition tmpMedValue, assign medTempC</technical_language>

Target:
public static Optional<InsightCard> processData(final Long accountId, final List<DeviceData> data, final Optional<Device.Color> colorOptional, final Optional<Calibration> calibrationOptional, final TemperatureUnit tempUnit) { if (data.isEmpty()) { return Optional.absent(); } final Device.Color color = colorOptional.or(Device.DEFAULT_COLOR); final DescriptiveStatistics stats = new DescriptiveStatistics(); for (final DeviceData deviceData : data) { final CalibratedDeviceData calibratedDeviceData = new CalibratedDeviceData(deviceData, color, calibrationOptional); stats.addValue(calibratedDeviceData.temperature()); stats.addValue(DataUtils.calibrateTemperature(deviceData.ambientTemperature)); } final int medTempC = (int) stats.getPercentile(50); final int medTempF = DataUtils.celsiusToFahrenheit(medTempC); LOGGER.debug("Temp for account {}: med C; F", accountId, medTempC, medTempF); int medTemp = medTempC; int idealMin = IDEAL_TEMP_MIN_CELSIUS; int idealMax = IDEAL_TEMP_MAX_CELSIUS; if (tempUnit == TemperatureUnit.FAHRENHEIT) { medTemp = medTempF; idealMin = IDEAL_TEMP_MIN; idealMax = IDEAL_TEMP_MAX; } Text text; if (medTemp >= idealMin && medTemp <= idealMax) { text = TemperatureMsgEN.getTempMsgPerfect(medTemp, tempUnit.toString()); } else if (medTemp < idealMin) { text = TemperatureMsgEN.getTempMsgTooCold(medTemp, tempUnit.toString(), idealMin); } else { text = TemperatureMsgEN.getTempMsgTooHot(medTemp, tempUnit.toString(), idealMax); } return Optional.of(InsightCard.createBasicInsightCard(accountId, text.title, text.message, InsightCard.Category.TEMPERATURE, InsightCard.TimePeriod.RECENTLY, DateTime.now(DateTimeZone.UTC), InsightCard.InsightType.DEFAULT)); }