public Double getDeterminant() {
        double positivo = 0.0;

        if (rows == 2 && cols == 2) {
            return values[0][0] * values[1][1] - values[1][0] * values[0][1];
        }

        for (int i = 0; i < rows; i++) {
            double mult = 1.0;

            for (int j = 0; j < cols; j++) {
                int row = i + j;

                if (row >= rows) {
                    row %= rows;
                }

                mult *= values[row][j];
            }

            positivo += mult;
        }

        double negativo = 0.0;

        for (int i = 0; i < rows; i++) {
            double mult = -1.0;

            for (int j = 0; j < cols; j++) {
                int row = i + j;

                if (row > rows - 1) {
                    row %= rows;
                }

                mult *= values[rows - 1 - row][j];
            }

            negativo += mult;
        }

        return positivo + negativo;
    }