public String toString() {
        String str = "[";
        for (int i = 0; i < matrix.length; i++) {
            for (int j = 0; j < matrix[i].length; j++) {
                str += matrix[i][j];
                if (j < matrix[i].length - 1) {
                    str += ",";
                } else if (i < matrix.length - 1) {
                    str += ";";
                }
            }
        }
        str += "]";
        return str;
    }