Sorting a two-dimensional array to check min and max random results.

I am working on a new project to learn more advanced uses of java, and have run into some very confusing output. the program should roll 2 6 sided dice 36000 times, storing the results (how many times each of the 21 possible combinations of rolls occurred) in a 2-d array, printing that array in tabular format, then copying the values to a 1d array to sort numericallly (ascending) then print which combination of rolls occured least and most, with how many occurences for each (least and most) here is the code I have, the error will be below it.
package d12;
//import classes to use
import java.util.Random;
import java.util.Arrays;
public class randomDice2D {
     * @param args the command line arguments
    public static void main(String[] args) {
//bring in new Random object
        Random r = new Random();
//declare all variables and arrays
        int[][] dieResults; dieResults = new int[6][6];
        int[] sortingResults; sortingResults=new int[37];
        int one;  int two;  int three;  int four;  int five;  int six;
        int seven;  int eight;  int nine;  int ten;  int eleven;  int twelve;
        int thirteen;  int fourteen;  int fifteen;  int sixteen;  int seventeen;
        int eighteen;  int nineteen;  int twenty;  int twentyone;
        //initialize all variables at 0
        one=0;  two=0;  three=0;  four=0;  five=0;  six=0;  seven=0;  eight=0;
        nine=0;  ten=0;  eleven=0;  twelve=0;  thirteen=0;  fourteen=0;
        fifteen=0;  sixteen=0;  seventeen=0;  eighteen=0;  nineteen=0;
        twenty=0;  twentyone=0;
//do dice rolling and count each iteration of each possible result - 36 possible??
        for (int i = 0; i < 36000; i++)
          int roll  = (r.nextInt(6) + 1) ;
          int roll2 = (r.nextInt(6) + 1) ;
        if (roll ==1 && roll2 == 1) ++one;
        if ((roll == 1 && roll2 == 2) || (roll2 == 1 && roll == 2)) ++two;
        if ((roll == 1 && roll2 == 3) || (roll2 == 1 && roll == 3)) ++three;
        if ((roll == 1 && roll2 == 4) || (roll2 == 1 && roll == 4)) ++four;
        if ((roll == 1 && roll2 == 5) || (roll2 == 1 && roll == 5)) ++five;
        if ((roll == 1 && roll2 == 6) || (roll2 == 1 && roll == 6)) ++six;
        if (roll == 2 && roll2 == 2) ++seven;
        if ((roll == 2 && roll2 == 3) || (roll2 == 2 && roll == 3)) ++eight;
        if ((roll == 2 && roll2 == 4) || (roll2 == 2 && roll == 4)) ++nine;
        if ((roll == 2 && roll2 == 5) || (roll2 == 2 && roll == 5)) ++ten;
        if ((roll == 2 && roll2 == 6) || (roll2 == 2 && roll == 6)) ++eleven;
        if ((roll == 3 && roll2 == 3)) ++twelve;
        if ((roll == 3 && roll2 == 4) || (roll2 == 3 && roll == 4)) ++thirteen;
        if ((roll == 3 && roll2 == 5) || (roll2 == 3 && roll == 5)) ++fourteen;
        if ((roll == 3 && roll2 == 6) || (roll2 == 3 && roll == 6)) ++fifteen;
        if (roll == 4 && roll2 == 4) ++sixteen;
        if ((roll == 4 && roll2 == 5) || (roll2 == 4 && roll == 5)) ++seventeen;
        if ((roll == 4 && roll2 == 6) || (roll2 == 4 && roll == 6)) ++eighteen;
        if (roll == 5 && roll2 == 5) ++nineteen;
        if ((roll == 5 && roll2 == 6) || (roll2 == 5 && roll == 6)) ++twenty;
        if (roll == 6 && roll2 == 6) ++twentyone;
        //assign results to array
        dieResults[0][0]=one;
        dieResults[1][0]=two; dieResults[0][1]=two;
        dieResults[2][0]=three;dieResults[0][2]=three;
        dieResults[3][0]=four;dieResults[0][3]=four;
        dieResults[4][0]=five;dieResults[0][4]=five;
        dieResults[5][0]=six;dieResults[0][5]=six;
        dieResults[1][1]=seven;
        dieResults[2][1]=eight;dieResults[1][2]=eight;dieResults[3][1]=nine;
        dieResults[1][3]=nine;dieResults[4][1]=ten;dieResults[1][4]=ten;
        dieResults[5][1]=eleven;dieResults[1][5]=eleven;
        dieResults[2][2]=twelve;
        dieResults[3][2]=thirteen;dieResults[2][3]=thirteen;
        dieResults[4][2]=fourteen;dieResults[2][4]=fourteen;
        dieResults[5][2]=fifteen;dieResults[2][5]=fifteen;
        dieResults[3][3]=sixteen;
        dieResults[4][3]=seventeen;dieResults[3][4]=seventeen;
        dieResults[5][3]=eighteen;dieResults[3][5]=eighteen;
        dieResults[4][4]=nineteen;
        dieResults[5][4]=twenty;dieResults[4][5]=twenty;
        dieResults[5][5]=twentyone;
        //print results
        for (int j=0; j<dieResults.length; j++){
            System.out.print("\n");
            for (int k=0; k<dieResults.length; k++){
            System.out.print("|"+dieResults[j][k]+"| ");
        // Verify program accuracy and ensure total reported results add up to 36000
System.out.println("\nValidate: 1's; "+dieResults[0][0]+" 1 & 2; "+dieResults[1][0]+
        dieResults[0][1]+" 4's; "+dieResults[2][0]+dieResults[0][2]+" 5's; "
        +dieResults[3][0]+dieResults[0][3]+" 6's; "+dieResults[4][0]+dieResults[0][4]
        +" 7's; "+dieResults[5][0]+dieResults[0][5]);
System.out.println("All total rolls add up to " + (dieResults[0][0] + dieResults[0][1] +
         dieResults[0][2] + dieResults[0][3] + dieResults[0][4] + dieResults[0][5]));
//check lowest/highest numbers entered to verify results are reasonable
//sort results to obtain lowest and highest number of rolls
    for (int l=0; l<sortingResults.length;l++){
     for (int m=0; m<sortingResults.length;m++){
        sortingResults[l]=dieResults[l][m];
Arrays.sort(sortingResults);
//determine and print what roll occurred the least
    if (sortingResults[0] == two)
        System.out.println("The lowest number of rolls for a single result is "
                + "2's with " + sortingResults[0]);
    if (sortingResults[0] == three)
        System.out.println("The lowest number of rolls for a single result is "
                + "3's with " + sortingResults[0]);
    if (sortingResults[0] == four)
        System.out.println("The lowest number of rolls for a single result is "
                + "4's with " + sortingResults[0]);
    if (sortingResults[0] == five)
        System.out.println("The lowest number of rolls for a single result is "
                + "5's with " + sortingResults[0]);
    if (sortingResults[0] == six)
        System.out.println("The lowest number of rolls for a single result is "
                + "6's with " + sortingResults[0]);
    if (sortingResults[0] == seven)
        System.out.println("The lowest number of rolls for a single result is "
                + "7's with " + sortingResults[0]);
    if (sortingResults[0] == eight)
        System.out.println("The lowest number of rolls for a single result is "
                + "8's with " + sortingResults[0]);
    if (sortingResults[0] == nine)
        System.out.println("The lowest number of rolls for a single result is "
                + "9's with " + sortingResults[0]);
    if (sortingResults[0] == ten)
        System.out.println("The lowest number of rolls for a single result is "
                + "10's with " + sortingResults[0]);
    if (sortingResults[0] == eleven)
        System.out.println("The lowest number of rolls for a single result is "
                + "11's with " + sortingResults[0]);
    if (sortingResults[0] == twelve)
        System.out.println("The lowest number of rolls for a single result is "
                + "12's with " + sortingResults[0]);
//determine and print what roll occurred the most
    if (dieResults[5][5] == two)
        System.out.println("The highest number of rolls for a single result is "
                + "2's with " + dieResults[10]);
    if (dieResults[5][5] == three)
        System.out.println("The highest number of rolls for a single result is "
                + "3's with " + dieResults[10]);
    if (dieResults[5][5] == four)
        System.out.println("The highest number of rolls for a single result is "
                + "4's with " + dieResults[10]);
    if (dieResults[5][5] == five)
        System.out.println("The highest number of rolls for a single result is "
                + "5's with " + dieResults[10]);
    if (dieResults[5][5] == six)
        System.out.println("The highest number of rolls for a single result is "
                + "6's with " + dieResults[10]);
    if (dieResults[5][5] == seven)
        System.out.println("The highest number of rolls for a single result is "
                + "7's with " + dieResults[10]);
    if (dieResults[5][5] == eight)
        System.out.println("The highest number of rolls for a single result is "
                + "8's with " + dieResults[10]);
    if (dieResults[5][5] == nine)
        System.out.println("The highest number of rolls for a single result is "
                + "9's with " + dieResults[10]);
    if (dieResults[5][5] == ten)
        System.out.println("The lohighestwest number of rolls for a single result is "
                + "10's with " + dieResults[10]);
    if (dieResults[5][5] == eleven)
        System.out.println("The highest number of rolls for a single result is "
                + "11's with " + dieResults[10]);
    if (dieResults[5][5] == twelve)
        System.out.println("The highest number of rolls for a single result is "
                + "12's with " + dieResults[10]);
}the output I got was this:
run:
|988| |2038| |1933| |2008| |2095| |2002|
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6
|2038| |965| |1973| |1982| |1985| |2028|
|1933| |1973| |1034| |1952| |1928| |2055|
|2008| |1982| |1952| |1010| |1981| |2023|
|2095| |1985| |1928| |1981| |1041| |1996|
|2002| |2028| |2055| |2023| |1996| |983| Validate: 1's; 988 1 & 2; 20382038 4's; 19331933 5's; 20082008 6's; 20952095 7's; 20022002
All total rolls add up to 11064
        at d12.randomDice2D.main(randomDice2D.java:101)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)I can see from the validate line in output that i need to start that line with a \n and change the formula of that println from
+dieResults[x][y]+dieResults[y][x]+
to
+(dieResults[x][y]+dieResults[y][x])+
I am also aware i have to finish listing all the elements of the array to add to the all total rolls line, but that I can add as I wait for an answer to the errors I don't see the solutions to. The last thing I need help with is how to print those results in a 2-d table format instead of one number per line. Should I change the pair of loops here:
for (int l=0; l<sortingResults.length;l++){
     for (int m=0; m<sortingResults.length;m++){
        sortingResults[l]=dieResults[l][m];
        }    }to a single loop repeated till the end like this?
for (int l=0; l<6; l++){
sortingResults[l]=dieResults[l][0];}
for (int m=0; m<5; m++){
sortingResults[(m+6)]=dieResults[m][1];}
for (int n=0; n<4; n++){
sortingResults[(n+11)]=dieResults[n][1];}or just take 21 lines (or 36 if i track all results instead of all unique) to declare each element like:
sortingResults[a]=dieResults[x][y];
Edited by: Geode on Oct 20, 2010 12:38 AM

Ok, I have done a lot and thought I had worked out all of the problems. Netbeans had no problems compiling it or running it, and the output was exactly what I expected it to be. Then I decided that the println starting "Validate:" was unneccessary since I printed the table right before it, so I deleted it. Noww Netbeans is telling me it compiles with errors every time i run it, even though it doesn't flag any line as having an error and it still executes exactly as I expect it to. Also, I was not able to find a way to make the three big sets of if's into loops. Any suggestions or ideas on how they could be looped would be most welcome. Also, any ideas on why Netbeans is saying it compiles with errors when it does not give any. I'll give the code and then the output again.
package d12;
//import classes to use
import java.util.Random;
import java.util.Arrays;
public class randomDice2D {
     * @param args the command line arguments
    public static void main(String[] args) {
//bring in new Random object
        Random r = new Random();
//declare all variables and arrays
        int[][] dieResults; dieResults = new int[6][6];
        int[] sortingResults; sortingResults=new int[36];
        int one; int two; int three; int four; int five; int six; int seven;
        int eight; int nine; int ten; int eleven; int twelve; int thirteen;
        int fourteen; int fifteen; int sixteen; int seventeen; int eighteen;
        int nineteen; int twenty; int twentyone; int twentytwo; int twentythree;
        int twentyfour; int twentyfive; int twentysix; int twentyseven;
        int twentyeight; int twentynine; int thirty; int thirtyone; int thirtytwo;
        int thirtythree; int thirtyfour; int thirtyfive; int thirtysix;
        //initialize all variables at 0
        one=0;two=0;three=0;four=0;five=0;six=0;seven=0;eight=0;nine=0;ten=0;
        eleven=0;twelve=0;thirteen=0;fourteen=0;fifteen=0;sixteen=0;seventeen=0;
        eighteen=0;nineteen=0;twenty=0;twentyone=0;twentytwo=0;twentythree=0;
        twentyfour=0;twentyfive=0;twentysix=0;twentyseven=0;twentyeight=0;
        twentynine=0;thirty=0;thirtyone=0;thirtytwo=0;thirtythree=0;thirtyfour=0;
        thirtyfive=0;thirtysix=0;
//do dice rolling and count each iteration of each possible result - 36 possible??
        for (int i = 0; i < 36000; i++)
          int roll  = (r.nextInt(6) + 1) ;
          int roll2 = (r.nextInt(6) + 1) ;
        if (roll == 1 && roll2 == 1) ++one;
        if (roll == 1 && roll2 == 2) ++two;
        if (roll == 1 && roll2 == 3) ++three;
        if (roll == 1 && roll2 == 4) ++four;
        if (roll == 1 && roll2 == 5) ++five;
        if (roll == 1 && roll2 == 6) ++six;
        if (roll == 2 && roll2 == 1) ++seven;
        if (roll == 2 && roll2 == 2) ++eight;
        if (roll == 2 && roll2 == 3) ++nine;
        if (roll == 2 && roll2 == 4) ++ten;
        if (roll == 2 && roll2 == 5) ++eleven;
        if (roll == 2 && roll2 == 6) ++twelve;
        if (roll == 3 && roll2 == 1) ++thirteen;
        if (roll == 3 && roll2 == 2) ++fourteen;
        if (roll == 3 && roll2 == 3) ++fifteen;
        if (roll == 3 && roll2 == 4) ++sixteen;
        if (roll == 3 && roll2 == 5) ++seventeen;
        if (roll == 3 && roll2 == 6) ++eighteen;
        if (roll == 4 && roll2 == 1) ++nineteen;
        if (roll == 4 && roll2 == 2) ++twenty;
        if (roll == 4 && roll2 == 3) ++twentyone;
        if (roll == 4 && roll2 == 4) ++twentytwo;
        if (roll == 4 && roll2 == 5) ++twentythree;
        if (roll == 4 && roll2 == 6) ++twentyfour;
        if (roll == 5 && roll2 == 1) ++twentyfive;
        if (roll == 5 && roll2 == 2) ++twentysix;
        if (roll == 5 && roll2 == 3) ++twentyseven;
        if (roll == 5 && roll2 == 4) ++twentyeight;
        if (roll == 5 && roll2 == 5) ++twentynine;
        if (roll == 5 && roll2 == 6) ++thirty;
        if (roll == 6 && roll2 == 1) ++thirtyone;
        if (roll == 6 && roll2 == 2) ++thirtytwo;
        if (roll == 6 && roll2 == 3) ++thirtythree;
        if (roll == 6 && roll2 == 4) ++thirtyfour;
        if (roll == 6 && roll2 == 5) ++thirtyfive;
        if (roll == 6 && roll2 == 6) ++thirtysix;
        //assign results to array
        dieResults[0][0]=one;dieResults[1][0]=seven; dieResults[0][1]=two;
        dieResults[2][0]=thirteen;dieResults[0][2]=three;dieResults[3][0]=nineteen;
        dieResults[0][3]=four;dieResults[4][0]=twentyfive;dieResults[0][4]=five;
        dieResults[5][0]=thirtyone;dieResults[0][5]=six;dieResults[1][1]=eight;
        dieResults[2][1]=fourteen;dieResults[1][2]=nine;dieResults[3][1]=twenty;
        dieResults[1][3]=ten;dieResults[4][1]=twentysix;dieResults[1][4]=eleven;
        dieResults[5][1]=thirtytwo;dieResults[1][5]=twelve;dieResults[2][2]=fifteen;
        dieResults[3][2]=twentyone;dieResults[2][3]=sixteen;dieResults[4][2]=twentyseven;
        dieResults[2][4]=seventeen;dieResults[5][2]=thirtythree;dieResults[2][5]=eighteen;
        dieResults[3][3]=twentytwo;dieResults[4][3]=twentyeight;dieResults[3][4]=twentythree;
        dieResults[5][3]=thirtyfour;dieResults[3][5]=twentyfour;dieResults[4][4]=twentynine;
        dieResults[5][4]=thirtyfive;dieResults[4][5]=thirty;dieResults[5][5]=thirtysix;
        //print results
        System.out.println("     1      2      3      4     5      6");
        for (int j=0; j<dieResults.length; j++){
            System.out.print("\n"+(j+1)+" -");
            for (int k=0; k<dieResults.length; k++){
            System.out.print("|"+dieResults[j][k]+"| ");
        // Verify program accuracy to ensure total results add up to 36000
System.out.println("\nAll total rolls add up to "+(dieResults[0][0]+dieResults[0][1]+
         dieResults[0][2]+dieResults[0][3]+dieResults[0][4]+dieResults[0][5]+
         dieResults[1][0]+dieResults[1][1]+dieResults[1][2]+dieResults[1][3]+
         dieResults[1][4]+dieResults[1][5]+dieResults[2][0]+dieResults[2][1]+
         dieResults[2][2]+dieResults[2][3]+dieResults[2][4]+dieResults[2][5]+
         dieResults[3][0]+dieResults[3][1]+dieResults[3][2]+dieResults[3][3]+
         dieResults[3][4]+dieResults[3][5]+dieResults[4][0]+dieResults[4][1]+
         dieResults[4][2]+dieResults[4][3]+dieResults[4][4]+dieResults[4][5]+
         dieResults[5][0]+dieResults[5][1]+dieResults[5][2]+dieResults[5][3]+
         dieResults[5][4]+dieResults[5][5]));
//check lowest/highest numbers entered to verify results are reasonable
//sort results to obtain lowest and highest number of rolls 
int z;z=0;
while (z < 36){
for (int l=0; l<6;l++){
     for (int m=0; m<6;m++){
        sortingResults[z]=dieResults[l][m];++z;
Arrays.sort(sortingResults);
//determine and print what roll occurred the least
    if (sortingResults[0] == one)
        System.out.println("The lowest number of rolls for a single result is "
                + "1's with " + sortingResults[0]);
    if (sortingResults[0] == two)
        System.out.println("The lowest number of rolls for a single result is "
                + "1 & 2 with " + sortingResults[0]);
    if (sortingResults[0] == three)
        System.out.println("The lowest number of rolls for a single result is "
                + "1 & 3 with " + sortingResults[0]);
    if (sortingResults[0] == four)
        System.out.println("The lowest number of rolls for a single result is "
                + "1 & 4 with " + sortingResults[0]);
    if (sortingResults[0] == five)
        System.out.println("The lowest number of rolls for a single result is "
                + "1 & 5 with " + sortingResults[0]);
    if (sortingResults[0] == six)
        System.out.println("The lowest number of rolls for a single result is "
                + "1 & 6 with " + sortingResults[0]);
    if (sortingResults[0] == seven)
        System.out.println("The lowest number of rolls for a single result is "
                + "2 & 1 with " + sortingResults[0]);
    if (sortingResults[0] == eight)
        System.out.println("The lowest number of rolls for a single result is "
                + "2 & 2 with " + sortingResults[0]);
    if (sortingResults[0] == nine)
        System.out.println("The lowest number of rolls for a single result is "
                + "2 & 3 with " + sortingResults[0]);
    if (sortingResults[0] == ten)
        System.out.println("The lowest number of rolls for a single result is "
                + "2 & 4 with " + sortingResults[0]);
    if (sortingResults[0] == eleven)
        System.out.println("The lowest number of rolls for a single result is "
                + "2 & 5 with " + sortingResults[0]);
    if (sortingResults[0] == twelve)
        System.out.println("The lowest number of rolls for a single result is "
                + "2 & 6 with " + sortingResults[0]);
    if (sortingResults[0] == thirteen)
        System.out.println("The lowest number of rolls for a single result is "
                + "3 & 1 with " + sortingResults[0]);
    if (sortingResults[0] == fourteen)
        System.out.println("The lowest number of rolls for a single result is "
                + "3 & 2 with " + sortingResults[0]);
    if (sortingResults[0] == fifteen)
        System.out.println("The lowest number of rolls for a single result is "
                + "3 & 3 with " + sortingResults[0]);
    if (sortingResults[0] == sixteen)
        System.out.println("The lowest number of rolls for a single result is "
                + "3 & 4 with " + sortingResults[0]);
    if (sortingResults[0] == seventeen)
        System.out.println("The lowest number of rolls for a single result is "
                + "3 & 5 with " + sortingResults[0]);
    if (sortingResults[0] == eighteen)
        System.out.println("The lowest number of rolls for a single result is "
                + "3 & 6 with " + sortingResults[0]);
    if (sortingResults[0] == nineteen)
        System.out.println("The lowest number of rolls for a single result is "
                + "4 & 1 with " + sortingResults[0]);
    if (sortingResults[0] == twenty)
        System.out.println("The lowest number of rolls for a single result is "
                + "4 & 2 with " + sortingResults[0]);
    if (sortingResults[0] == twentyone)
        System.out.println("The lowest number of rolls for a single result is "
                + "4 & 3 with " + sortingResults[0]);
    if (sortingResults[0] == twentytwo)
        System.out.println("The lowest number of rolls for a single result is "
                + "4 & 4 with " + sortingResults[0]);
    if (sortingResults[0] == twentythree)
        System.out.println("The lowest number of rolls for a single result is "
                + "4 & 5 with " + sortingResults[0]);
    if (sortingResults[0] == twentyfour)
        System.out.println("The lowest number of rolls for a single result is "
                + "4 & 6 with " + sortingResults[0]);
    if (sortingResults[0] == twentyfive)
        System.out.println("The lowest number of rolls for a single result is "
                + "5 & 1 with " + sortingResults[0]);
    if (sortingResults[0] == twentysix)
        System.out.println("The lowest number of rolls for a single result is "
                + "5 & 2 with " + sortingResults[0]);
    if (sortingResults[0] == twentyseven)
        System.out.println("The lowest number of rolls for a single result is "
                + "5 & 3 with " + sortingResults[0]);
    if (sortingResults[0] == twentyeight)
        System.out.println("The lowest number of rolls for a single result is "
                + "5 & 4 with " + sortingResults[0]);
    if (sortingResults[0] == twentynine)
        System.out.println("The lowest number of rolls for a single result is "
                + "5 & 5 with " + sortingResults[0]);
    if (sortingResults[0] == thirty)
        System.out.println("The lowest number of rolls for a single result is "
                + "5 & 6 with " + sortingResults[0]);
    if (sortingResults[0] == thirtyone)
        System.out.println("The lowest number of rolls for a single result is "
                + "6 & 1 with " + sortingResults[0]);
    if (sortingResults[0] == thirtytwo)
        System.out.println("The lowest number of rolls for a single result is "
                + "6 & 2 with " + sortingResults[0]);
    if (sortingResults[0] == thirtythree)
        System.out.println("The lowest number of rolls for a single result is "
                + "6 & 3 with " + sortingResults[0]);
    if (sortingResults[0] == thirtyfour)
        System.out.println("The lowest number of rolls for a single result is "
                + "6 & 4 with " + sortingResults[0]);
    if (sortingResults[0] == thirtyfive)
        System.out.println("The lowest number of rolls for a single result is "
                + "6 & 5 with " + sortingResults[0]);
    if (sortingResults[0] == thirtysix)
        System.out.println("The lowest number of rolls for a single result is "
                + "6 & 6 with " + sortingResults[0]);
//determine and print what roll occurred the most
    if (sortingResults[35] == one)
        System.out.println("The highest number of rolls for a single result is "
                + "1's with " + sortingResults[35]);
    if (sortingResults[35] == two)
        System.out.println("The highest number of rolls for a single result is "
                + "1 & 2 with " + sortingResults[35]);
    if (sortingResults[35] == three)
        System.out.println("The highest number of rolls for a single result is "
                + "1 & 3 with " + sortingResults[35]);
    if (sortingResults[35] == four)
        System.out.println("The highest number of rolls for a single result is "
                + "1 & 4 with " + sortingResults[35]);
    if (sortingResults[35] == five)
        System.out.println("The highest number of rolls for a single result is "
                + "1 & 5 with " + sortingResults[35]);
    if (sortingResults[35] == six)
        System.out.println("The highest number of rolls for a single result is "
                + "1 & 6 with " + sortingResults[35]);
    if (sortingResults[35] == seven)
        System.out.println("The highest number of rolls for a single result is "
                + "2 & 1 with " + sortingResults[35]);
    if (sortingResults[35] == eight)
        System.out.println("The highest number of rolls for a single result is "
                + "2 & 2 with " + sortingResults[35]);
    if (sortingResults[35] == nine)
        System.out.println("The highest number of rolls for a single result is "
                + "2 & 3 with " + sortingResults[35]);
    if (sortingResults[35] == ten)
        System.out.println("The highest number of rolls for a single result is "
                + "2 & 4 with " + sortingResults[35]);
    if (sortingResults[35] == eleven)
        System.out.println("The highest number of rolls for a single result is "
                + "2 & 5 with " + sortingResults[35]);
    if (sortingResults[35] == twelve)
        System.out.println("The highest number of rolls for a single result is "
                + "2 & 6 with " + sortingResults[35]);
    if (sortingResults[35] == thirteen)
        System.out.println("The highest number of rolls for a single result is "
                + "3 & 1 with " + sortingResults[35]);
    if (sortingResults[35] == fourteen)
        System.out.println("The highest number of rolls for a single result is "
                + "3 & 2 with " + sortingResults[35]);
    if (sortingResults[35] == fifteen)
        System.out.println("The highest number of rolls for a single result is "
                + "3 & 3 with " + sortingResults[35]);
    if (sortingResults[35] == sixteen)
        System.out.println("The highest number of rolls for a single result is "
                + "3 & 4 with " + sortingResults[35]);
    if (sortingResults[35] == seventeen)
        System.out.println("The highest number of rolls for a single result is "
                + "3 & 5 with " + sortingResults[35]);
    if (sortingResults[35] == eighteen)
        System.out.println("The highest number of rolls for a single result is "
                + "3 & 6 with " + sortingResults[35]);
    if (sortingResults[35] == nineteen)
        System.out.println("The highest number of rolls for a single result is "
                + "4 & 1 with " + sortingResults[35]);
    if (sortingResults[35] == twenty)
        System.out.println("The highest number of rolls for a single result is "
                + "4 & 2 with " + sortingResults[35]);
    if (sortingResults[35] == twentyone)
        System.out.println("The highest number of rolls for a single result is "
                + "4 & 3 with " + sortingResults[35]);
    if (sortingResults[35] == twentytwo)
        System.out.println("The highest number of rolls for a single result is "
                + "4 & 4 with " + sortingResults[35]);
    if (sortingResults[35] == twentythree)
        System.out.println("The highest number of rolls for a single result is "
                + "4 & 5 with " + sortingResults[35]);
    if (sortingResults[35] == twentyfour)
        System.out.println("The highest number of rolls for a single result is "
                + "4 & 6 with " + sortingResults[35]);
    if (sortingResults[35] == twentyfive)
        System.out.println("The highest number of rolls for a single result is "
                + "5 & 1 with " + sortingResults[35]);
    if (sortingResults[35] == twentysix)
        System.out.println("The highest number of rolls for a single result is "
                + "5 & 2 with " + sortingResults[35]);
    if (sortingResults[35] == twentyseven)
        System.out.println("The highest number of rolls for a single result is "
                + "5 & 3 with " + sortingResults[35]);
    if (sortingResults[35] == twentyeight)
        System.out.println("The highest number of rolls for a single result is "
                + "5 & 4 with " + sortingResults[35]);
    if (sortingResults[35] == twentynine)
        System.out.println("The highest number of rolls for a single result is "
                + "5 & 5 with " + sortingResults[35]);
    if (sortingResults[35] == thirty)
        System.out.println("The highest number of rolls for a single result is "
                + "5 & 6 with " + sortingResults[35]);
    if (sortingResults[35] == thirtyone)
        System.out.println("The highest number of rolls for a single result is "
                + "6 & 1 with " + sortingResults[35]);
    if (sortingResults[35] == thirtytwo)
        System.out.println("The highest number of rolls for a single result is "
                + "6 & 2 with " + sortingResults[35]);
    if (sortingResults[35] == thirtythree)
        System.out.println("The highest number of rolls for a single result is "
                + "6 & 3 with " + sortingResults[35]);
    if (sortingResults[35] == thirtyfour)
        System.out.println("The highest number of rolls for a single result is "
                + "6 & 4 with " + sortingResults[35]);
    if (sortingResults[35] == thirtyfive)
        System.out.println("The highest number of rolls for a single result is "
                + "6 & 5 with " + sortingResults[35]);
    if (sortingResults[35] == thirtysix)
        System.out.println("The highest number of rolls for a single result is "
                + "6 & 6 with " + sortingResults[35]);
}and here is the output (after clicking 'Run Anyways' on the project compiled with errors message from Netbeans)
run:
     1      2      3      4     5      6
1 -|995| |1014| |1076| |976| |1015| |1000|
2 -|971| |982| |993| |1067| |983| |1011|
3 -|990| |951| |1019| |968| |1011| |1023|
4 -|999| |931| |1009| |987| |1020| |1022|
5 -|969| |954| |997| |970| |1016| |1028|
6 -|955| |1014| |996| |996| |1075| |1017|
All total rolls add up to 36000
The lowest number of rolls for a single result is 4 & 2 with 931
The highest number of rolls for a single result is 1 & 3 with 1076
BUILD SUCCESSFUL (total time: 13 seconds)

Similar Messages

  • Sorting a two dimensional array in descending order..

    Guy's I'm a beginning Java programmer. I've been struggling with finding documentation on sorting a two dimensional primitive array in descending order.. The following is my code which goes works, in ascending order. How do I modify it to make the list write out in descending order?
    class EmployeeTable
         public static void main(String[] args)
         int[][] hours = {
              {2, 4, 3, 4, 5, 8, 8},
              {7, 3, 4, 3, 3, 4, 4},
              {3, 3, 4, 3, 3, 2, 2},
              {9, 3, 4, 7, 3, 4, 1},
              {3, 5, 4, 3, 6, 3, 8},
              {3, 4, 4, 6, 3, 4, 4},
              {3, 7, 4, 8, 3, 8, 4},
              {6, 3, 5, 9, 2, 7, 9}};
         int [] total = new int [hours.length];
         for (int i = 0; i < hours.length ; i++){
              for (int j = 0; j < hours.length ; j++){
                   total[i] += hours[i][j];
         int[] index = new int[hours.length];
         sortIndex(total, index);
    for (int i = 0; i < hours.length; i++)
    System.out.println("Employee " + index[i] + " hours are: " +
    total[i]);
    static void sortIndex(int[] list, int[] indexList) {
    int currentMax;
    int currentMaxIndex;
    for (int i = 0; i < indexList.length; i++)
    indexList[i] = i;
    for (int i = list.length - 1; i >= 1; i--) {
    currentMax = list[i];
    currentMaxIndex = i;
    for (int j = i - 1; j >= 0; j--) {
    if (currentMax < list[j]) {
    currentMax = list[j];
    currentMaxIndex = j;
    // How do I make it go in descending order????
    if (currentMaxIndex != i) {
    list[currentMaxIndex] = list[i];
    list[i] = currentMax;
    int temp = indexList[i];
    indexList[i] = indexList[currentMaxIndex];
    indexList[currentMaxIndex] = temp;

    Bodie21 wrote:
    nclow all you wrote was
    "This looks to me like a homework assignment that you're asking us to solve for you. Your description of what it does isn't even correct. It doesn't sort a 2d array.
    You would probably elicit better help if you could demonstrate that you've done some work and have something specific that you don't understand."
    To me that sounds completely sarcastic. You didn't mention anything constructive besides that.. Hence I called you a male phalic organ, not a rear exit...Bodie21, OK, now you've got 90% of us who regularly contribute to this forum thinking your the pr&#105;ck. Is that what you wanted to do? If so, mission accomplished. Many will be looking for your name next time you ask for help. Rude enough for you?

  • Sorting a two dimensional array

    Hello!
    I have a twodimensional array that consists of 6 other arrays
    (like array[0 to 5][0 to 4]). The [4] of each sub-array is a index
    number that i'd like to use for sorting the array[0][x] to
    array[5][x] according to their array[x][4]-value. How would I do
    that?
    Thanks!

    use a custom sort function. check the sort() method of the
    array class for sample coding.

  • Creating one and two Dimensional array

    Hi guys my problem is as follows
    (1)I want to create a two dimensional array of 10 rows and 20 columns
    (2)Populate the array with random integers
    (3)convert the two dimensinal array into one dimensional array int[]nums
    (4)print the content of one and two dimensional arrays to the screen

    You don't learn much about coding if you don't write any code. Without seeing the code that was written it's very difficult to assist a person, since your solution may not be anywhere close to their solution. If the poster just wants the code to hand in or use as is then there is no learning happening.
    So, step 1 - post your code, step 1a - ask a clear question.
    Just my opinions
    Lee

  • How can I do two dimensional arrays?

    I am a C++ programmer and in C++ I am able make a two dimensional array and input the values that correspond to those cells.
    After I saw the proposals that you (experts) made I am going to share a little of the classified information that I was working for the undefeatable XO game.
    First step:My idea was to make a two dimensional array(in C++ we use the following syntex for two dimensional array{array[i][j]})
    I was wondering if I am able to make a two dimensional array using LABVIEW .
    Second step: Store the values of X or O inside the 2D array.And use maybe boolean variables(in C++ we use inaddition to that if statement).
    My second question :What can I do inorder to minimize the number of boolean vaariables?(also if statements in C++)
    Jupiter
    extinct when hell froze over

    This is a subroutine I use to check for a winner in a XO game.
    While playing, the main code replaces default 0's by 1's inside the 2D array of a single player.
    Then the main code calls this VI with the 2D array of that player and check for a winning game.
    Any board size is ok as long as you have equal number of cols & rows.
    So, enter 1's at any location in the "Score" 2D array and the code will check for a winning game.
    As you can see I don't use any boolean variables, except the return value of this VI (read function) 
    So to answer your second question; I minimized the use of boolean variables to 0 1! Is that ok for you?
    Attachments:
    TTT-Check4Winner.vi ‏20 KB

  • Return a two dimensional array

    Hi,
    I'm probably doing this wrong from the start, but I have an two dimensional array with only integers. These are the result of some mathematical calculations (aren't they always? :-) ) and I need to use those in another class. So I placed this array in a Vector and used this as a return value.
    It looks like this:
    final int[][] somArray = new int[aantalSommen][3];
    Vector maalSommen= new Vector();
    somArray[counter][0] =A;
    somArray[counter][1] =B;
    maalSommen.add(somArray[counter]);
    return maalSommen;So now I have this array into a vector, I can't get the values out.
    in the code below Vector sommen is the vector containing the array.
    for (int i =0;i<sommen.size(); i++ ) {
      int [][] som=(int[][]) sommen.elementAt(i);
    }The above code is not working.It gives me a cast error..

    ok, this is my attempt for the sscce...
    This class generates the results I need..
    public Vector MaalSommen(int aantalSommen, int[] TafelReeks) {
              final Vector maalSommen = new Vector();
              final int[][] somArray = new int[aantalSommen][3];
              boolean dupesCheck=false;
              int A = 1;
              int B=1;
              for (int counter=0; counter<aantalSommen; counter++) {
                   A=generator.nextInt(10);
                   B=randomizeArray(TafelReeks);
                   // check for dupes..
                   while ( ! dupesCheck) {
                        if (!( dupesCheck=checkDupes(A,B, counter,somArray))) {
                             A=generator.nextInt(10);
                             B=randomizeArray(TafelReeks);
                   dupesCheck=false;// reset the checker
                   somArray[counter][0] =A;
                   somArray[counter][1] =B;
                   somArray[counter][2] =somArray[counter][0]* somArray[counter][1];
                       maalSommen.add(somArray[counter]);
              return maalSommen;
         }What I think is happening is I put the array into the vector..But it turn out this is not the case..

  • How to get number of rows and columns in a two dimensional array ?

    Hello,
    What would be the simplest way to get number of rows and columns in a two dimensional array represented as integers ?
    I'm looking for another solution as For...Each loop in case of large arrays.
    Regards,
    Petri

    Hi Petri,
    See a attached txt file for obtaining two arrays with upper and lower index values
    Regards
    Ray
    Regards
    Ray Farmer
    Attachments:
    Get2DArrayIndex.txt ‏2 KB

  • I have two numbers listed in my messages tab under settings.  One number is checked(mine) and the other is not(my sons).  However when someone sends me a text it goes to both mine and my sons iphones.  How do i delete his number from my phone.

    I have two numbers listed in my messages tab under settings.  One number is checked(mine) and other is not(my sons).  However when someone sends me a test it goes to both numbers.  Mine and my sons.  How do I delete his number so that he no longer received texts intended for me.

    The best way is to not share Apple IDs but also make sure under Settings & Messages on both devices that only one phone number is checked.

  • How to copy data in text file into two-dimensional arrays?

    Greeting. Can somebody teach me how to copy the input file into two-dimensional arrays? I'm stuck in making a matrix with number ROWS and COLUMNS according to the data in "input.txt"
    import java.io.*;
    import java.util.*;
    public class array
        public static void main (String[] args) throws FileNotFoundException
        { Scanner sc = new Scanner (new FileReader("input.txt"));
            PrintWriter outfile = new PrintWriter("output.txt");
        int[][]matrix = new int[ROWS][COLUMNS];
    }my input.txt :
    a,b,c
    2,2,1
    1,1,1
    2,2,1
    3,3,1
    4,4,1
    5,5,1
    1,6,2
    2,7,2
    3,8,2
    4,9,2
    5,10,2

    import java.io.*;
    import java.util.*;
    public class array {
        public static void main(String[] args) throws IOException {
            FileInputStream in = null;
            FileOutputStream out = null;
    try {
        in = new FileInputStream("input.txt");
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String line = null;
        while ((line = reader.readLine()) != null) {
            String split[]=line.split(",");
    catch (IOException x) {
        System.err.println(x);
    } finally {
        if (in != null) in.close();
    }}}What after this?

  • How to use two dimensional array in custom.pll

    HI
    How to use two dimensional arrays in custom.pll
    I tried by the following way .
    type ship_array is table of number index by binary_integer;
    type vc_array is table of ship_array index by binary_integer;
    But I am getting the error as that
    A plsql table may not contain a table or a record with composite fields.
    Please tell me the way how to use them

    which forms version are you using? two dimensional arrays are available in >= 9i if memory serves.
    regards

  • Variable number of two dimensional arrays into one big array

    I have a variable number of two dimensional arrays.
    The first dimension is variable, the second dimension is always 7.
    i.e.:
    Object[][] array0 = {
    {"tim", "sanchez", 34, 175.5, "bla", "blub", "[email protected]"},
    {"alice", "smith", 42, 160.0, "la", "bub", "[email protected]"},
    Object[][] array1 = {
    {"john", "sdfs", 34, 15.5, "a", "bl", "[email protected]"},
    {"joe", "smith", 42, 16.0, "a", "bub", "[email protected]"},
    Object[][] arrayi = ...I'm generating these arrays with a for-loop:
         for (int i = 0; i < filter.length; i++) {
              MyClass c = new MyClass(filter);
              //data = c.getData();
    Where "filter" is another array which is filled with information that tells "MyClass" how to fill the arrays.
    "getData()" gives back one of the i number of arrays.
    Now I just need to have everything in one big two dimensional array.
    i.e.:Object[][] arrayComplete = {
    {"tim", "sanchez", 34, 175.5, "bla", "blub", "[email protected]"},
    {"alice", "smith", 42, 160.0, "la", "bub", "[email protected]"},
    {"john", "sdfs", 34, 15.5, "a", "bl", "[email protected]"},
    {"joe", "smith", 42, 16.0, "a", "bub", "[email protected]"},
    Any idea on how to accomplish this? It's blowing my mind right now.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Just brainstorming here:
    Why not put your actual data in a class and store that in a LinkedList (so you know the total number of elements for your multi-dimensional array). Then initalize your multi-dimensional array and populate it? Haven't tested the following, but thinking something along the lines of
    public class MyData {
         //data here
         public Object[] toArray() {
              //something similar to this
              return new Object[] = {"tim", "sanchez", 34, 175.5, "bla", "blub", "[email protected]"};
    LinkedList<MyData> data = new LinkedList<MyData>();
    data.add(mydata1);
    //however many times you need
    Object[][] arrayComplete = new Object[data.size()][7];
    for(int i = 0; i < data.size(); i++) {
         arrayComplete[i] = data.removeFirst().toArray();
    }Another option for knowing how many rows you would need might be using something like:
    int rows = 0;
    rows += array1.length;
    rows += array2.length;
    //etc...But is not entirely useful if you don't know how many variable arrays you have (although reflections might help if the name of the array variable is incremented systematically, someone told me earlier to avoid reflections since it could make debugging a LOT more difficult).
    Edited by: bogdana on Apr 1, 2010 10:38 AM

  • Problem returning a two-dimensional array in web service

    Hello. I'm having problems returning a two dimensional array in my web service. The service returns a MyClass[][] correctly, but the client receives a different one.
    I've done a test that returns a MyClass[1][1] an the client shows a MyClass[1][20]. All the MyClass objects returned in the array are the same and all it's fields are null. There's even an element of the array containing null instead of the object. As I say, the service creates the array ok, but the client gets other thing.
    I have other methods returning one-dimensional arrays MyClass[] and I have no problem.
    My system:
    WindowsXP
    Tomcat 5.5 (Axis 1.3?)
    JDK 1.5
    Eclipse 3.3
    My wsdl is generated with eclipse, although I've had to update my wsdd manually.
    Any Ideas?
    Thanks.

    Does it have to be stored in an array?
    Because you could use the java.awt.Point class, and a
    java.util.Set to create random points until you have
    the correct number of unique points.Of course it is no must to store it in an array. it was just my first thought of approaching the problem. I will try the Point.class. Thanks for that hint.

  • Count the number of values in a two dimensional array

    i am trying to figure out how to count the number of values in a two dimensional array.
    numScores = student[i][j].length;This doesn't work, i am trying to find a way of counting the columns

    Object[][] o;
    int tot = 0;
    for(int x = 0 ; x < o.length ; x++)
       tot += o[x].length;
    }If it's not a jagged array, however, this would be easier:
    int tot = o.length * o[0].length;

  • Set number of elements in a two dimensional array

    Hi,
    Does anyone know how to set the number of elements in a two dimensional array directly in teststand.
    To set a one dimsional array is simple:
    SetNumElements( locals.somearray,4)
    Is there a method to do this for a two dimensional array?
    Sean

    From the help file (TestStand 4.2.0):
    PropertyObject.SetNumElements
    SetNumElements Method
    Syntax
    PropertyObject.SetNumElements ( numElements, options = 0)
    Purpose
    Sets the number of elements of a single dimensional array.
    Remarks
    This method is only valid for single dimensional arrays. The elements in the array retain their values. Use the PropertyObjectType.ArrayDimensions property to set the number of elements in each dimension of a multi-dimensional array.
    Parameters
    numElements As Long
    [In] New number of elements for the array.
    options As Long
    [In] Pass 0 to specify the default behavior, or pass one or more PropertyOptions constants. Use the bitwise-OR operator to specify multiple options.
    This parameter has a default value of 0.
    So you could use, for example: Locals.MultidimensionalArray.Type.ArrayDimensions.SetBounds({1,0},{3,4}) to set an array to have three dimensions (1,2,3), each with five elements (0,1,2,3,4).

  • Two dimensional array in JSP with struts

    Is it possible to use two dimensional array in an web application
    based on struts. I am using JSP and to get data from two dimensional
    array im using
    property = "array[0][0]";I read on the internet that bean utils does not support two dimensional array?
    I have a table like spreadsheet with 30 rows and 20 columns and i was
    planning to use two dimensional array? is there any other way to get
    this stuff done easily?
    any ideas welcome.

    HI ,
    i have the same problem you had
    did you get any solution for this?
    if so you can help me out

Maybe you are looking for

  • YouTube ads keep videos from playing

    I've experienced this problem lately during the last few days or so: I use Safari to go to the YouTube website on my iPad, and select a video. An ad starts playing, I skip it when/if it allows me to do so. Next, a Toyota ad starts playing (currently

  • Update to 10.6.7 "writing files" for 14 hours?

    How do I get it to finish?  Can I stop it somehow without messing up my computer?

  • Why does the website ok cupid no longer load properly?

    This site does not load pictures, only text. I worked fine until about a month ago.

  • Two load errors for a standard SRM Contract ODS

    We've just installed standard business content for SRM Contract ODS.  The standard InfoSource we installed is 0BBP_TD_CONTR_1.   Two loading errors occur: 1st error: No return value <> 0 allowed in update routines in transfer mode      Diagnosis The

  • "Full Quality" Export looks rubbish

    I've created a slide show, with some transitions and text, about 3 minutes long. It looks and plays fine when playing in full screen mode from iMovie but when exported to Quicktime it losses soo much quality, im using the full quality setting but it