1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
ArrayList<Integer> matriceDesIndicesValantUn = new ArrayList<Integer>();
// fais attention a tes indentations, sans alignement des parentheses, le code est difficile à lire
// nb_ligne en java ça fait nombreLignes
for(int i = 0; i < nombreLignes; i++)
{
// c'est ton "var" mais comme ce n'etait pas tres parlant...
ArrayList<Integer> listeDesIndicesValantUn = new ArrayList<Integer>();
// c'est ton "br"
ligne = myBufferedReader.readLine();
ligne = ligne.trim();
// plus basique :
String[] ligneParties = ligne.split(" ");
for (int k = 0; k < ligneParties.length; k++)
{
// on teste si le chiffre est 1.
if (new Integer(ligneParties[k]).intValue() == 1)
{ // on stocke l'indice (et plus le 1). J'ai bien compris ?
listeDesIndicesValantUn.add(new Integer(k));
}
}
matriceDesIndicesValantUn.add(listeDesIndicesValantUn);
} |
Partager