Improve defaultJava() function and run `go fmt`