private double metodoMontante(double[][] a, double pa) { Pivote p = new Pivote(a); int fp = p.getX(); int cp = p.getY(); boolean finalIter = a.length == 2; double[][] nmat = new double[a.length-1][a.length-1]; int x = 0, y = 0; double e = 0; for (int i = 0; i < a.length; i++) { if (i == fp) continue; for (int j = 0; j < a[0].length; j++) { if (j == cp) continue; e = transformaElemento(p.getValue(), a[i][j], a[i][fp], a[cp][j], pa); if (finalIter) // THIS IS WHAT I WANT TO AVOID return e; nmat[x][y++] = e; } ++x; y = 0; } return metodoMontante(nmat, p.getValue()); }