@Override
    public String toString() {
        // StringBuffer sb = new StringBuffer();
        StringBuilder sb = new StringBuilder(); // Intellij IDEA advised to use StringBuilder instead of StringBuffer
        sb.append("ComplexMatrix [\n");
        for (int i = 0; i < getRowsNum(); i++) {
            sb.append("  [");
            for (int j = 0; j < getColsNum(); j++) {
                try {
                    sb.append(getElem(i, j).toString());
                } catch (Exception e) {
                    System.out.println("Exception in ComplexMatrix s.append(getElem(i, j).toString())");
                    e.printStackTrace();
                }
                if (j < getColsNum() - 1) {
                    sb.append(",  ");
                }
            }
            sb.append("]\n");
        }
        sb.append("]");
        return sb.toString();
    }