SourceFormatX

Overview

Features

Why Use It

Formatting Show

Integration

Screenshots

Documentation

FAQs & Tips

Update History

Award Gallery

Testimonials

License Policy

CodeMorph

CodeToHtml

Java Source Code Formatting Show


Feature

SourceFormatX code formatter bases on powerful syntax parse engines so it can beautify and format source code files with omnifarious styles, even these messy source code examples below:

C/C++ Java C# Delphi (Pascal)
PHP JSP ASP JavaScript
Visual Basic VB.NET VBScript HTML Components
80x86 ASM 8051 ASM CORBA IDL


  Java Source Code Formatting Examples:     Example 1   |   Example 2   |   Example 3   |   Example 4

This is an extreme java code formatting example, the purpose of it is to show the power of Java syntax parse engine powered by SourceFormatX Java Code Formatting Tool.

  /* Before Java Code Formatting */

  package cryptix.examples;import java.io.FileInputStream;import
  java.io.IOException;import cryptix.security.MD5;
  /** This is a demo of how to use the MD5 or SHA1 classes for hashing data **/
  public final class MD5AFile{private static final int BUF_LENGTH=1024;public
  static void main(String argv[]){if(argv.length!=1)System.err.println(
  "usage java MD5Afile filename");else try{printHash(doHash(argv[0]));}catch(
  IOException ioe){System.err.println(
  "There has been an IO exception to the file was not hashed.");
  ioe.printStackTrace();}}private static void printHash(byte buf[]){
  System.out.println("hash of file is;");System.out.print("MD5 : ");for(int i=0,j
  =buf.length;j>0;i++,j--){int val=(int)buf[i];System.out.print(Integer.toString(
  (val>>4)&0xF,16));System.out.print(Integer.toString(val&0xF,16));}
  System.out.println();}}


  /* After Java Code Formatting */

  package cryptix.examples;
  import java.io.FileInputStream;
  import java.io.IOException;
  import cryptix.security.MD5;

  /** This is a demo of how to use the MD5 or SHA1 classes for hashing data **/

  public final class MD5AFile
  {
    private static final int BUF_LENGTH = 1024;
    public static void main(String argv[])
    {
      if (argv.length != 1)
        System.err.println("usage java MD5Afile filename");
      else
      try
      {
        printHash(doHash(argv[0]));
      }
      catch (IOException ioe)
      {
        System.err.println(
          "There has been an IO exception to the file was not hashed.");
        ioe.printStackTrace();
      }
    }
    private static void printHash(byte buf[])
    {
      System.out.println("hash of file is;");
      System.out.print("MD5 : ");
      for (int i = 0, j = buf.length; j > 0; i++, j--)
      {
        int val = (int)buf[i];
        System.out.print(Integer.toString((val >> 4) & 0xF, 16));
        System.out.print(Integer.toString(val & 0xF, 16));
      }
      System.out.println();
    }
  }

Example 1   |   Example 2   |   Example 3   |   Example 4

  Don't waste time on formatting Java code by hand any more!  Use SourceFormatX Java Code Formatter to format your Java code.