Here is a solution with ntheorem. I define a wrap theorem style, which simply uses \hangindent and \hangafter:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage[thmmarks, amsmath, thref]{ntheorem}
\makeatletter
\newlength{\wrapboxlg}
\newtheoremstyle{wrap}%%
{\item[\hskip\labelsep\Large\theorem@headerfont ##1~##2\theorem@separator]
\mbox{}\endgraf\settowidth{\wrapboxlg}{\Large\theorem@headerfont ##1~##2\theorem@separator\normalsize\enspace}
\vskip-1.5\baselineskip
\hangindent = \wrapboxlg\hangafter =-2\noindent
}%
{\item[\hskip\labelsep\Large\theorem@headerfont ##1~##2]
\mbox{}\endgraf\settowidth{\wrapboxlg}{\Large\theorem@headerfont ##1~##2\theorem@separator\normalsize\enspace}
\vskip-1.5\baselineskip
\hangindent = \wrapboxlg\hangafter =-2\noindent
{\theorem@headerfont (##3)\theorem@separator}\ }%
\makeatother
\theoremstyle{wrap}
\theoremheaderfont{\upshape\bfseries}
\theorembodyfont{\normalfont}
\theoremseparator{.}
\newtheorem{Ex}{Example}[section]
\usepackage{lipsum}
\begin{document}
\setcounter{section}{1}
\setcounter{Ex}{22}
\begin{Ex}
\lipsum[11]
\end{Ex}
\bigskip
\begin{Ex}[This is the example title]
Sed feugiat. Cum sociis natoque penatibus et magnis dis par-
turient montes, nascetur ridiculus mus. Ut pellentesque augue
sed urna. Vestibulum diam eros, fringilla et, consectetuer eu, nonummy id,
sapien. Nullam at lectus. In sagittis ultrices mauris. Curabitur malesuada
erat sit amet massa. Fusce blandit. Aliquam erat volutpat. Aliquam euismod.
Aenean vel lectus. Nunc imperdiet justo nec dolor.
\end{Ex}
\end{document}

wrapfig? – Ignasi Mar 14 '17 at 17:45wrapfigureenvironment where thetcolorboxmimes the title, i.e. something like here: http://tex.stackexchange.com/questions/358298/titled-box-or-sidebar-of-variable-width-for-additional-text – Mar 14 '17 at 17:51Regarding the wrapfigure, this looks like the way to go. I'll have a look at it soon. Note however that in the particular example that @Christian links to, the text that wraps around the theorem environment, is not the content of the theorem. In my example, I would like the content of the theorem to wrap around the title.
– geo909 Mar 14 '17 at 18:21