void (String[] arr, int expectedCnt) { boolean tooLong = false; for (String s : arr) { int cnt = s.length(); cnt += arr.length; <warning descr="Loop can be terminated after condition is met">if</warning> (cnt > expectedCnt) { tooLong = true; } } }