我的程序很乱很乱,谁帮我整理一下
我些了个程序,代码是一点一点加上去的,最后好乱啊,谁可以帮我整理一下,比如将它的分成几个功能块啊什么的,让人看上去舒服点。还有麻烦帮我优化一下代码,提高一点效率啊!现在我自己看着看着也晕了
public class bj123
{
static class Card
{
String value;
char color;
int num;
int bijiao;
public Card(char color,int bijiao,String value,int num)
{
this.color=color;
this.bijiao=bijiao;
this.value=value;
this.num=num;
}
}
static char[] colors={6,3,5,4};
static int bijiao[]={4,3,2,1};
static String[] values= { "A ", "2 ", "3 ", "4 ", "5 ", "6 ", "7 ", "8 ", "9 ", "10 ", "J ", "Q ", "K "};
static int[] nums={12,13,1,2,3,4,5,6,7,8,9,10,11};
public static void main(String arg[])
{
Card porke[]=new Card[52];int k=0;
System.out.println( "洗牌前,牌的顺序为: ");
for(int i=0;i <=3;i++)
for(int j=0;j <13;j++,k++)
{
porke[k]=new Card(colors[i],bijiao[i],values[j],nums[j]);
System.out.print(porke[k].color+porke[k].value+ " ");
}
System.out.println();
int a[]=new int[52];
for (int i=0;i <a.length;i++)
{
a[i]=(int)(Math.random()*52);
for(int j=0;j <i;j++)
if(a[j]==a[i])
i=i-1;