@Override
    public Matrix calculate() {
        Matrix resultMatrix = new Matrix();
        List<Future<Matrix>> list = new ArrayList<Future<Matrix>>();
        int threadAmount = 4;
        ExecutorService executor = Executors.newFixedThreadPool(threadAmount);
        int part = size / threadAmount;
        if (part < 1) {
            part = 1;
        }
        for (int i = 0; i < size ; i += part) {
            Callable<Matrix> worker = new MultiplicationSubMatrix(this.matrix1,this.matrix2, i, i + part, size);
            Future<Matrix> submit = executor.submit(worker);
            list.add(submit);
        }
        int start = 0;
        Matrix futureMatrix;
        for( int i = 0; i<size; i++){
            resultMatrix.addRow();
            for(int j = 0; j < size; j++){
                resultMatrix.getElement(i).add(0);
            }
        }
        for (Future<Matrix> future : list) {
            try {

                futureMatrix = future.get();
                for (int i = start; i < start + part; i += 1) {
                    resultMatrix.setElement(i, futureMatrix.getElement(i));
                }
            } catch (Exception e) {
                System.out.println("cannot create resultMatrix");
            }
            start += part;
        }
        executor.shutdown();

        return resultMatrix;
    }