:
eval 'exec perl -w -S `echo $0 | sed "s/.*\///" ` ${1+"$@"}' 
    if 0;
@a=@ARGV; @flags=grep(/^-/,@a); @files=grep(-f,@a); @ARGV=@files; @other=(); 
@other=grep(!-d,grep(!-f,grep(!/^-/,@a))); @dirs=(); @dirs=grep(-d,@a); 
if ( grep( /^-h(elp)?$/,@flags) or ( ! @a and eof(ARGV) and eof(STDIN) ) ) {
 	$scriptName = $0; $scriptName =~ s%^.*/%%;
	print <<"END";
Usage: $scriptName [-h -help] [ <file | file1 file2...] 
Modify spaces to follow code conventions at
http://java.sun.com/docs/codeconv/index.html 
END
exit;}
use bytes;

$rN="\n"; $rN="\r\n" if ( ! -d "/var" );

$lastblank = 0;
while (defined($line=<>)) { 
	chomp $line; chomp $line;
	$line =~ s/\t/        /g; # replace tabs
	$line =~ s/\s+$//;        # delete trailing blanks

# always put a space between a keyword and an opening parenthesis or brace.
$line =~ s/\b(abstract|assert|break|case|catch|class|const|continue|default|do|else|enum|extends|final|finally|for|goto|if|implements|import|instanceof|interface|native|new|package|private|protected|public|return|static|strictfp|switch|synchronized|this|throw|throws|transient|try|volatile|while)([({])/$1 $2/g;

# put a space between a closing parenthesis and opening brace.
      $line =~ s/\)\{/) {/g;

# put access keyword first
$line =~ s/(static|final|volatile)\s+(public|private|protected)/$2 $1/g;

# suppress more than one consecutive blank line
      $blankline = ($line =~ m/^$/);
      if (!$blankline or !$lastblank ) {
	 print "$line\n" 
      }
      $lastblank = $blankline;
}

