0

(Java) I need help making to strings equal each other in length ,but I feel like i did my loop wrong

This is my loop I am doing this for the Vigneer Cypher so I am trying to make the strings equal each other in length So i created this loop for(int i = 0;i<plainText.length();i++,j++){ if(j == bellasoStr.length()) j = 0; if(bellasoStr.length()==plainText.length()) break; bellasoStr+=bellasoStr.charAt(j); } However I dont know if I formated or created the loop correct

23rd Mar 2020, 10:13 PM
Angelica
Angelica - avatar
2 Antworten
+ 2
If you define j = 0 then your code should work. https://code.sololearn.com/cB1676wGVWLk/?ref=app
23rd Mar 2020, 11:08 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
thanks
27th Mar 2020, 9:28 AM
Angelica
Angelica - avatar