Here you can find the source of putWeightToBin(SortedMap
private static void putWeightToBin(SortedMap<Double, Double> hist, double bin, double weight)
//package com.java2s; //License from project: Open Source License import java.util.SortedMap; public class Main { private static void putWeightToBin(SortedMap<Double, Double> hist, double bin, double weight) { if (null != hist) { if (hist.containsKey(bin)) { hist.put(bin, hist.get(bin) + weight); } else { hist.put(bin, weight);//from ww w . j a va2 s. c om } } } }