|
Java Source Code Formatting Show |
|
| |
|
|
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:
|
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.
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();}}
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.
|