boolean (@NotNull String name) { int firstDotIndex = name.indexOf('.'); if (firstDotIndex == -1) { return false; } // Several extension if name contains another dot return name.indexOf('.', firstDotIndex + 1) != -1; }