import java.util.*;
public class Table {
static Scanner console = new Scanner(System.in);
public static void main (String[] args)
{
String list = "010509131721252933374145495357616569737702030406070810111214" +
"151618192022232426272830313234353638394042434446474850515254" +
"5556585960626364666768707172747576787980818283848586878889909192";
String number;
int counter = 0;
int counter2 = 0;
int randomNumber = 0;
Vector row_selection = new Vector();
Vector row_0 = new Vector();
Vector row_1 = new Vector();
Vector row_2 = new Vector();
Vector row_3 = new Vector();
Vector row_4 = new Vector();
Vector row_5 = new Vector();
Vector row_6 = new Vector();
Vector row_7 = new Vector();
Vector row_8 = new Vector();
Vector row_9 = new Vector();
for (counter2=0; counter2<40;)
{
//-----------------------------------------------------------------------
for (counter=0; counter<10; counter++)
{
do{randomNumber = (int) (10 * Math.random());}
while(randomNumber == 10);
row_selection.addElement(randomNumber);
}
//-----------------------------------------------------------------------
for (counter=0; counter<10;)
{
number = list.substring(counter2, counter2 + 2);
if (row_selection.indexOf(counter) != -1)
{
if (counter2 >= 20 && counter2 <30)
{
switch (counter)
{
case 0:
if(row_0.indexOf("21",0) != -1)
{
row_0.insertElementAt(number, (row_0.indexOf("21",0)));
}
else
{
row_0.addElement(number);
}
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
case 1:
if(row_1.indexOf("21",0) != -1)
{
row_1.insertElementAt(number, (row_1.indexOf("21",0)));
}
else if (row_1.indexOf("25",0) != -1)
{
row_1.insertElementAt(number, (row_1.indexOf("25",0)));
}
else if (row_1.indexOf("29",0) != -1)
{
row_1.insertElementAt(number, (row_1.indexOf("29",0)));
}
else if (row_1.indexOf("33",0) != -1)
{
row_1.insertElementAt(number, (row_1.indexOf("33",0)));
}
else if (row_1.indexOf("37",0) != -1)
{
row_1.insertElementAt(number, (row_1.indexOf("37",0)));
}
else
{
row_1.addElement(number);
}
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
case 2:
if(row_2.indexOf("21",0) != -1)
{
row_2.insertElementAt(number, (row_2.indexOf("21",0)));
}
else if (row_2.indexOf("25",0) != -1)
{
row_2.insertElementAt(number, (row_2.indexOf("25",0)));
}
else if (row_2.indexOf("29",0) != -1)
{
row_2.insertElementAt(number, (row_2.indexOf("29",0)));
}
else if (row_2.indexOf("33",0) != -1)
{
row_2.insertElementAt(number, (row_2.indexOf("33",0)));
}
else if (row_2.indexOf("37",0) != -1)
{
row_2.insertElementAt(number, (row_2.indexOf("37",0)));
}
else
{
row_2.addElement(number);
}
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
case 3:
if(row_3.indexOf("21",0) != -1)
{
row_3.insertElementAt(number, (row_3.indexOf("21",0)));
}
else if (row_3.indexOf("25",0) != -1)
{
row_3.insertElementAt(number, (row_3.indexOf("25",0)));
}
else if (row_3.indexOf("29",0) != -1)
{
row_3.insertElementAt(number, (row_3.indexOf("29",0)));
}
else if (row_3.indexOf("33",0) != -1)
{
row_3.insertElementAt(number, (row_3.indexOf("33",0)));
}
else if (row_3.indexOf("37",0) != -1)
{
row_3.insertElementAt(number, (row_3.indexOf("37",0)));
}
else
{
row_3.addElement(number);
}
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
case 4:
if(row_4.indexOf("21",0) != -1)
{
row_4.insertElementAt(number, (row_4.indexOf("21",0)));
}
else if (row_4.indexOf("25",0) != -1)
{
row_4.insertElementAt(number, (row_4.indexOf("25",0)));
}
else if (row_4.indexOf("29",0) != -1)
{
row_4.insertElementAt(number, (row_4.indexOf("29",0)));
}
else if (row_4.indexOf("33",0) != -1)
{
row_4.insertElementAt(number, (row_4.indexOf("33",0)));
}
else if (row_4.indexOf("37",0) != -1)
{
row_4.insertElementAt(number, (row_4.indexOf("37",0)));
}
else
{
row_4.addElement(number);
}
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
case 5:
if(row_5.indexOf("21",0) != -1)
{
row_5.insertElementAt(number, (row_5.indexOf("21",0)));
}
else if (row_5.indexOf("25",0) != -1)
{
row_5.insertElementAt(number, (row_5.indexOf("25",0)));
}
else if (row_5.indexOf("29",0) != -1)
{
row_5.insertElementAt(number, (row_5.indexOf("29",0)));
}
else if (row_5.indexOf("33",0) != -1)
{
row_5.insertElementAt(number, (row_5.indexOf("33",0)));
}
else if (row_5.indexOf("37",0) != -1)
{
row_5.insertElementAt(number, (row_5.indexOf("37",0)));
}
else
{
row_5.addElement(number);
}
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
case 6:
if(row_6.indexOf("21",0) != -1)
{
row_6.insertElementAt(number, (row_1.indexOf("21",0)));
}
else if (row_6.indexOf("25",0) != -1)
{
row_6.insertElementAt(number, (row_6.indexOf("25",0)));
}
else if (row_6.indexOf("29",0) != -1)
{
row_6.insertElementAt(number, (row_6.indexOf("29",0)));
}
else if (row_6.indexOf("33",0) != -1)
{
row_6.insertElementAt(number, (row_6.indexOf("33",0)));
}
else if (row_6.indexOf("37",0) != -1)
{
row_6.insertElementAt(number, (row_6.indexOf("37",0)));
}
else
{
row_6.addElement(number);
}
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
case 7:
if(row_7.indexOf("21",0) != -1)
{
row_7.insertElementAt(number, (row_7.indexOf("21",0)));
}
else if (row_7.indexOf("25",0) != -1)
{
row_7.insertElementAt(number, (row_7.indexOf("25",0)));
}
else if (row_7.indexOf("29",0) != -1)
{
row_7.insertElementAt(number, (row_7.indexOf("29",0)));
}
else if (row_7.indexOf("33",0) != -1)
{
row_7.insertElementAt(number, (row_7.indexOf("33",0)));
}
else if (row_7.indexOf("37",0) != -1)
{
row_7.insertElementAt(number, (row_7.indexOf("37",0)));
}
else
{
row_7.addElement(number);
}
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
case 8:
if(row_8.indexOf("21",0) != -1)
{
row_8.insertElementAt(number, (row_8.indexOf("21",0)));
}
else if (row_8.indexOf("25",0) != -1)
{
row_8.insertElementAt(number, (row_8.indexOf("25",0)));
}
else if (row_8.indexOf("29",0) != -1)
{
row_8.insertElementAt(number, (row_8.indexOf("29",0)));
}
else if (row_8.indexOf("33",0) != -1)
{
row_8.insertElementAt(number, (row_8.indexOf("33",0)));
}
else if (row_8.indexOf("37",0) != -1)
{
row_8.insertElementAt(number, (row_8.indexOf("37",0)));
}
else
{
row_8.addElement(number);
}
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
case 9:
if(row_9.indexOf("21",0) != -1)
{
row_9.insertElementAt(number, (row_9.indexOf("21",0)));
}
else if (row_9.indexOf("25",0) != -1)
{
row_9.insertElementAt(number, (row_9.indexOf("25",0)));
}
else if (row_9.indexOf("29",0) != -1)
{
row_9.insertElementAt(number, (row_9.indexOf("29",0)));
}
else if (row_9.indexOf("33",0) != -1)
{
row_9.insertElementAt(number, (row_9.indexOf("33",0)));
}
else if (row_9.indexOf("37",0) != -1)
{
row_9.insertElementAt(number, (row_9.indexOf("37",0)));
}
else
{
row_9.addElement(number);
}
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
}
}
else{
switch (counter)
{
case 0:
row_0.addElement(number);
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
case 1:
row_1.addElement(number);
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
case 2:
row_2.addElement(number);
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
case 3:
row_3.addElement(number);
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
case 4:
row_4.addElement(number);
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
case 5:
row_5.addElement(number);
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
case 6:
row_6.addElement(number);
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
case 7:
row_7.addElement(number);
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
case 8:
row_8.addElement(number);
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
case 9:
row_9.addElement(number);
row_selection.removeElementAt(row_selection.indexOf(counter));
counter2 = counter2 + 2;
break;
}
}
}
else {counter++;}
}
}
//-----------------------------------------------------------------------
System.out.println(row_0);
System.out.println(row_1);
System.out.println(row_2);
System.out.println(row_3);
System.out.println(row_4);
System.out.println(row_5);
System.out.println(row_6);
System.out.println(row_7);
System.out.println(row_8);
System.out.println(row_9);
}
}
Thx.