FindBugs

From EggeWiki

FindBugs is an open source project which identifies potential problems with your code by doing byte code analysis. Here are some common problems, and easy fixes:

Invocation of toString on an array

The code invokes toString on an array, which will generate a fairly useless result such as [C@16f0472. Consider using Arrays.toString to convert the array into a readable String that gives the contents of the array. See Programming Puzzlers, chapter 3, puzzle 12.

<geshi lang="java5"> Object a[] = { "a", "b" }; System.out.println(a); </geshi>

The result is [Ljava.lang.Object;@12152e6. A better way to do this is:

<geshi lang="java5"> Object a[] = { "a", "b" }; System.out.println(Arrays.asList(a).toString()); </geshi>

which outputs [a, b].