public Integer[] getBestMatchingCell(Integer c, Integer t) {
        Integer minSegments = null;
        Integer cellIndex = -1;
        Integer minSegmentsCellIndex = -1;

        LinkedList<LinkedList<Boolean>> list = activeState.get(t);
        Integer maxActivity = 0;
        Integer result = -1;

        for(int i=0;i<cellsPerColumn;i++) {
            for(int j = 0; j < dendriteSegments.get(c).get(i).size(); j++) {
                Integer counter = 0;
                Segment segment = dendriteSegments.get(c).get(i).get(j);
                for(Synapse syn: segment.synapses) {
                    if(list.get(syn.c).get(syn.i)) {
                        counter++;
                    }
                }
                if (maxActivity < counter) {
                    maxActivity = counter;
                    result = j;
                    cellIndex = i;
                }
            }
            if (minSegments == null || minSegments > dendriteSegments.get(c).get(i).size()) {
                minSegments = dendriteSegments.get(c).get(i).size();
                minSegmentsCellIndex = i;
            }
        }
        return maxActivity > minThreshold ? new Integer[]{c, cellIndex, result} : new Integer[]{c, minSegmentsCellIndex, -1};
    }