\usepackage{listings}
\begin{document}
\lstset{language=Java}
\begin{lstlisting}[frame=single]
PDDocument doc = PDDocument.load(file);
String content = new PDFTextStripper().getText(doc);
doc.close();
return new Indexitem((long)file.getName().hashCode(), file.getName(), content);
\end{lstlisting}
\end{document}
Considering the above code, my question is how to fit the code into its block? Assuming we are using a double-column template.