【发布时间】:2015-08-26 08:55:16
【问题描述】:
这是我的哈希图:
if (m1.get(image.getRGB(x, y)) == null) {
m1.put(image.getRGB(x, y), 1);
} else {
int newValue = Integer.valueOf(String.valueOf(m1.get(image.getRGB(x, y))));
newValue++;
m1.put(image.getRGB(x, y), newValue);
}
然后我这样打印:
for (Object key : m1.keySet()) {
Color temp = new Color((int) key);
int r = temp.getRed();
int g = temp.getGreen();
int b = temp.getBlue();
System.out.println("r: " + r + " G: " + g + " B: " + b+ "\t\tValue: " + m1.get(key));
}
如何选择我的 hashmap 的第二个值(hashmap 中的第二个最大值)将其值保存在另一个变量中?
【问题讨论】:
-
second value是什么意思? -
第二高(换句话说,第二最大值)