Hi everyone, I'd like to create a program in which all rows and columns of a given matrix are inverted. The matrix elements are objects Bin<Double,Integer>, where Double is the value, Integer is the priority (that can be 0 or 1). When i reorder the matrix, I have to replace the entire Objects

For example :

Schermata 2019-10-31 alle 06.35.18.png

I've thought something like this, but i don't think it's quite correct:

for(int i=0;i<matrix.length;i++){

for(int k=0;k<matrix.length;k--) {

for(int j=0;j<matrix.length;j++){

for (int s = 0; s < matrix.length; s--) {

Bin<Double,Integer> element = new Bin<>();

element= mat_simmetrica[i][j];

mat_simmetrica[i][j]=mat_simmetrica[k][s];

mat_simmetrica[k][s]=element;

}

j++;

}

}

i++;

}