Adding java source code to extract K monthly timevalues for each key from the given timeseries of varying lenght