| | |
| | | import java.math.RoundingMode; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Paths; |
| | | import java.text.DecimalFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | |
| | | double target = Double.parseDouble(targetStr); |
| | | double deviationPercent = Math.abs(target - average) / average * 100; |
| | | |
| | | return deviationPercent; |
| | | // 保留两位小数 |
| | | DecimalFormat df = new DecimalFormat("#.00"); |
| | | String formatted = df.format(deviationPercent); |
| | | return Double.parseDouble(formatted); |
| | | } |
| | | |
| | | /** |