You can change basicstyle and linewidth to achieve what you want. I, for example, use the following within my lstlistings-settings:
basicstyle=\footnotesize\ttfamily,
linewidth=\textwidth
Additionally, I import the courier package to get a nicer font for ttfamilyusing \usepackage{courier}
EDIT: I also use Java code within LaTeX documents quite regularly. This is how my total setup looks like:
\lstset{
basicstyle=\footnotesize\ttfamily,
linewidth=\textwidth,
numbers=left,
numberstyle=\tiny\emptyaccsupp,
columns=flexible,
numbersep=5pt, % Abstand der Nummern zum Text
tabsize=3,
breaklines=true,
keywordstyle=\color{RoyalBlue}\textbf,
commentstyle=\color{ForestGreen},
frame=bottomline,
stringstyle=\color{WildStrawberry}\ttfamily,
showspaces=false,
showtabs=false,
xleftmargin=17pt,
framexleftmargin=17pt,
framexrightmargin=5pt,
framexbottommargin=4pt,
showstringspaces=false,
literate=%
{Ö}{{\"O}}1
{Ä}{{\"A}}1
{Ü}{{\"U}}1
{ß}{{\ss}}2
{ü}{{\"u}}1
{ä}{{\"a}}1
{ö}{{\"o}}1
}
\lstloadlanguages{
Java
}
lstsetoptionscolumns=fullflexibleandbasicstyle=\smallor evenbasicstyle=\scriptsize. – guillem Dec 14 '12 at 7:33