Need help let's say there is an array:
String[] s = {"26", "8", "15", "12", "11", "12"}; It is necessary to do so if we are looking for "12", as a result, it was entered into one variable:
String a = "1212"; and if the string "12" is not in the array, then
String a = "0"; I wrote the following code but it does not work correctly:
String[] s = {"26", "8", "15", "12", "11", "12"}; for (int i = 0; i < s.length; i++) { if (s[i].equals("12")) { d += s[i]; System.out.println(d); } else { d = "0"; } } System.out.println(d);
i++instead of++iin the first cycle ♦