public int[][] calculate(int threadsCount) throws InterruptedException {
        Thread[] threads = new Thread[threadsCount];
        int workForThread = (size * size > threadsCount) ? size * size / threadsCount : 1;
        for (int i = 0; i < threadsCount - 1; i++) {
            threads[i] = new Thread(new MultiplicationRunnable(i * workForThread, i * workForThread + workForThread));
            threads[i].start();
        }
        threads[threadsCount - 1] = new Thread(new MultiplicationRunnable((threadsCount - 1) * workForThread, size * size));
        threads[threadsCount - 1].start();

        for (Thread thread : threads) {
            thread.join();
        }

        System.out.println("done");
        return result;
    }