La consigna es, en base a una matriz con 1 y 0, cada vez que encuentre un 0, cambiar los elementos de la fila y columnas al que pertenece por 0.
ejemplo: matriz1 = {{1,0,1},{1,1,1}} y el resultado deberia ser {{0,0,0},{1,0,1}}
este es mi codigo: el cual de momento me devuelve: {{0,0,0},{1,1,0}}
public int[][] completarMatrizConCeros(int[][] mat) {
int[][] ret;
ret = new int[mat.length][mat[0].length];
int f = 0; int c = 0;
int ff = 0; int cc = 0;
while(f<mat.length){
if(c == mat[0].length-1){
f++; c = 0;
}else{
if(mat[f][c]!= 0){
ret[f][c] = mat[f][c];
}if(mat[f][c] == 0){
while(ff < mat.length && cc < mat[0].length){
if(ff < mat.length){
ret[ff][c] = 0;
ff++;
}if(cc<mat[0].length-1){
ret[f][cc] = 0;
cc++;
}
} ff = 0; cc = 0;
}
c++; }
}return ret;
}