boolean (@NotNull CharSequence text, @NotNull CharSequence suffix) { int l1 = text.length(); int l2 = suffix.length(); if (l1 < l2) return false; for (int i = l1 - 1; i >= l1 - l2; i--) { if (text.charAt(i) != suffix.charAt(i + l2 - l1)) return false; } return true; }