boolean (@NotNull CharSequence element) { int textLength = element.length(); if (textLength <= 4) return false; // Ends with three dots… if (element.charAt(textLength - 3) != '.') return false; if (element.charAt(textLength - 2) != '.') return false; if (element.charAt(textLength - 1) != '.') return false; // But doesn't end with four dots and more if (element.charAt(textLength - 4) == '.') return false; return true; }