Bonjour, je suis face à un paradoxe que je ne comprend pas du tout, voici le code

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
public class main {
 
	public static void main(String[] args) {
 
		char [] tj = new char [] {'T','T','G','T','T','T','A','C','G','T','G','C','A','G','G','A','G','C','A','T'};
		char [] ti = new char [] {'T','G','G','A','G','C','A','T','T','G','T','T','T','A','C','G','T','G','C','A','G','G','A','G','C','A','T'};
		int j = tj.length-1;
		int i = ti.length-1;
 
		while(i>=0 && j>=0) {
			if (tj[j]==ti[i]){
				i--;
				j--;
			}
			else{
				i--;
			}
			System.out.println("i="+i+"   "+"j="+j);
		}
 
	}
 
}
ce qui donne le résultat suivant :

i=25 j=18
i=24 j=17
i=23 j=16
i=22 j=15
i=21 j=14
i=20 j=13
i=19 j=12
i=18 j=11
i=17 j=10
i=16 j=9
i=15 j=8
i=14 j=7
i=13 j=6
i=12 j=5
i=11 j=4
i=10 j=3
i=9 j=2
i=8 j=1
i=7 j=0
i=6 j=-1



Mais je comprend pas pourquoi la boucle while s’arrête, on a bien i = 6 et dans les conditions d’arrêt de la boucle i et j doivent être inférieur à 0 ors il y a que j qui est inférieur à 0 pas i.