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 grace.cards;import com.objectspace.jgl.Stack;import
  com.objectspace.jgl.algorithms.Shuffling;public class Deck{Stack cards=new
  Stack();public Deck(){reset();}protected void reset(){for(int suit=Card.CLUB;
  suit<=Card.SPADE;++suit){for(int num=0;num<13;++num){cards.push(new Card(num,
  suit));}}Shuffling.randomShuffle(cards);}public Card[]deal(int numCards){Card[]
  result=new Card[numCards];for(int i=0;i<numCards;++i){result[i]=(Card)cards.pop
  ();}return result;}public void shuffle(){reset();}}


  /* After Java Code Formatting */

  package grace.cards;

  import com.objectspace.jgl.Stack;
  import com.objectspace.jgl.algorithms.Shuffling;

  public class Deck
  {
    Stack cards = new Stack();

    public Deck()
    {
      reset();
    }

    protected void reset()
    {
      for (int suit = Card.CLUB; suit <= Card.SPADE; ++suit)
      {
        for (int num = 0; num < 13; ++num)
        {
          cards.push(new Card(num, suit));
        }
      }

      Shuffling.randomShuffle(cards);
    }

    public Card[] deal(int numCards)
    {
      Card[] result = new Card[numCards];
      for (int i = 0; i < numCards; ++i)
      {
        result[i] = (Card)cards.pop();
      }
      return result;
    }

    public void shuffle()
    {
      reset();
    }
  }

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.