@Override
protected void cleanup(Context context) throws IOException, InterruptedException {
for (Map.Entry<Double, String> entry : sortedMap.descendingMap().entrySet()) {
DecimalFormat decimalFormat = new DecimalFormat("#");
String formattedNumber = decimalFormat.format(entry.getKey());
context.write(new Text(entry.getValue()),new Text(formattedNumber + ".0"));
}
}
做数值计算的时候发现double计算数值比较大的时候,出现了数据后面加E符号的情况,这是因为使用了科学计数法的原因
解决方法:
解除科学计数法