bug de la matrice ArrayList<ArrayList<Float>>
Bonjour,
voila,
j'ai un problème la valeur "tpi" que je passe au tableau "tempi" tempi.add(tpi);
quand j'affecte à tpi= (float) (((2 * i +1) * u * 180) / 16); la pas de problème mais quand je la passe dans un ArrayList elle devine vide !! :bug:
Code:
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
import java.util.ArrayList;
public class Formule {
public static void affiche_Mtrice(ArrayList<ArrayList<Float>> matrice) {
ArrayList<Float> tps = new ArrayList();
for(int i=0; i< matrice.size(); i++)
{
tps = matrice.get(i);
System.out.println("\t"+tps.get(0)+"\t"+tps.get(1)+"\t"+tps.get(2)+"\t"+tps.get(3)+"\t"+tps.get(4)+"\t");
}
/*
for(ArrayList<Float> tab : matrice)
{
for(float str : tab)
{
System.out.println("\t"+str);
}
System.out.println("\n");
} */
}
public static void main(String[] args) {
// int i = 0,j=0,u=0,v=0;
ArrayList<ArrayList<Float>> qi = new ArrayList(),
qj = new ArrayList();
//////////////////////////
ArrayList<Float> tempi = new ArrayList();
float tpi=0;
for(int u = 0; u < 8; u++)
{
for(int i =0; i < 8; i++)
{
tpi= (float) (((2 * i +1) * u * 180) / 16);
System.out.println("tpi= "+tpi);
tempi.add(tpi); // les valeur ne passpas la !!!??????????
//tempi.add( ( ( (2 * (float)i +1) * (float)u * 180) / 16) );
System.out.println("\t=="+tempi.get(i));
}
qi.add(tempi);
}
/////////////////////////
affiche_Mtrice(qi);
/////////////////////////
}
} |
je ne comprenant pas le bug !!
:aie:
si quelqu'un peu m'aider.