private static ArrayList<Entries> cutEntries(Entries entries, long cutInSeconds) {
		if (entries.size() == 0) return null;

		ArrayList<Entries> result = new ArrayList<Entries>();
		
		// get the min timeStart and the max timeEnd, 
		// just in case it is not sorted
		long minTimeStart = Long.MAX_VALUE;
		long maxTimeEnd = Long.MIN_VALUE;
		for (int i=0; i<entries.size(); i++) {
			if ( entries.get(i).timeStart < minTimeStart ) minTimeStart = entries.get(i).timeStart;
			if ( entries.get(i).timeEnd > maxTimeEnd ) maxTimeEnd = entries.get(i).timeEnd;
		}
		
		// create an empty collection
		int arrLen = (int) (((maxTimeEnd - minTimeStart-1) / cutInSeconds ) +1);
		for (int i=0; i<arrLen; i++) {
			Entries e = new Entries();
			result.add(e);
		}
		
		//System.err.println("minTimeStart: " + minTimeStart);
		//System.err.println("maxTimeEnd: " + maxTimeEnd);
		// process each entry in the entries
		for (int i=0; i<entries.size(); i++) {
			long timeStart = entries.get(i).timeStart;
			long timeEnd = entries.get(i).timeEnd;
			// find out in which index they belong to
			int startIdx = (int) ((timeStart - minTimeStart) / cutInSeconds);
			int endIdx = (int) ((timeEnd - minTimeStart-1) / cutInSeconds);
			//System.err.println((timeStart-minTimeStart)+"["+startIdx + "], "+ (timeEnd-minTimeStart) +"[" + endIdx+"]");
			//System.err.println((timeStart)+"["+startIdx + "], "+ (timeEnd) +"[" + endIdx+"]");
			// if both of them are in the same idx
			if (startIdx == endIdx) {
				// add the entry 
				result.get(startIdx).add(entries.get(i));
			} else {
				// add the startIdx
				Entry oldEntry = entries.get(i);
				long endOfStartIdx = (startIdx+1) * cutInSeconds;
				endOfStartIdx += minTimeStart;
				Entry newEntry = new Entry(oldEntry.timeStart, endOfStartIdx, oldEntry.value);
				result.get(startIdx).add(newEntry);
				
				// add all in the middle
				
				for (int j=startIdx+1; j<endIdx; j++) {
					newEntry = new Entry (minTimeStart+(j*cutInSeconds), minTimeStart+((j+1) * cutInSeconds), oldEntry.value);
					result.get(j).add(newEntry);
				}
				
				
				// add the endIdx
				long startOfEndIdx = endIdx * cutInSeconds;
				startOfEndIdx += minTimeStart; 
				newEntry = new Entry(startOfEndIdx, oldEntry.timeEnd, oldEntry.value);
				result.get(endIdx).add(newEntry);
			}
		}
		
		// System.err.println(result);
		return result;
				
	}