public ArrayList getConnectedNeurons(int neuronNumber) {
        ArrayList connectedNeurons = new ArrayList();

        if ((neuronNumber < colNumber * rowNumber) && (neuronNumber > 0)){
            if (neuronNumber - colNumber > 0) {
                connectedNeurons.add(neuronNumber - colNumber);
            }

            if ((neuronNumber - 1 > 0) && ((neuronNumber % colNumber) != 1)) {
                connectedNeurons.add(neuronNumber - 1);
            }

            if ((neuronNumber + 1 <= colNumber * rowNumber)
                    && ((neuronNumber % colNumber) != 0)) {
                connectedNeurons.add(neuronNumber + 1);
            }

            if (neuronNumber + colNumber <= colNumber * rowNumber) {
                connectedNeurons.add(neuronNumber + colNumber);
            }
        }
      return connectedNeurons;   
    }