Thanks to Alex, you may now use
[code=java]your.code.here[/code]
to show syntax highlighted code in a forum post! There are of course other languages available as well. A list of valid syntax aliases is here: http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/
Note that it will not display in the "Preview" mode, but it does work when you really post. It's a known, minor shortcoming of the SMF plugin, but not really important once you know that it works.
Demo:
for (int i = 0; i < 100; i++) {
System.out.println("Test");
}