You can download the plugin from http://wordpress.org/extend/plugins/wp-syntax/. And it supports highlighting with or without line numbers and maintains formatting while copying snippets of code from the browser.
But it’s not very convenient to use it, when edit a post, I must use the ‘html view’ mode, and add
public class Hello {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
class Example
def example(arg1)
return "Hello: " + arg1.to_s
end
end