I personally use indentation, all code inside a brace is indented an extra level. Also I tend to never put braces at the end of a line, by starting them on a new line they themselves line up.
Finally, I break up the majority of my functions, only a rare few exceed 1 sceenful of code.
For example I would write this
Traversing a Directory example as the following;
Formatted for
Java with the GeSHI Syntax Highlighter [
copy or print]
public class TraverseDirectory
{
private static void processDir
(File dir
) {
System.
out.
print( (dir.
isDirectory() ? "[D] : " : "[F] : ")); }
private static void traverse
(File dir
) {
processDir(dir);
if (dir.isDirectory())
{
String[] children
= dir.
list(); for (int i=0; i<children.length; i++)
{
traverse
(new File(dir, children
[i
])); }
}
}
/**
* Sole entry point to the class and application.
* @param args Array of String arguments.
*/
public static void main
(String[] args
) {
traverse
(new File("new_dir")); }
}
This is, admittedly, slightly different to their code style.