Solved

Counting occurences of ints in an ArrayList

Posted on 2011-03-21
11
523 Views
Last Modified: 2012-05-11
I have an arraylist of 6000 ints.  Each int is a random number from 1-25.  I want to output the numbers 1-25 in order, from the number that occured the most to the one that occured the least.

I have been working on this for days, and I keep getting duplicates in my output.  I have gotten so frustrated that I decided that I would start from scratch.

I am probably making this process way more complicated than it has to be though.

this is example output I am going for:

1   2   3   4   5
6   7   8   9  10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25

these numbers, again would start at the top left if they were the most frequently occurring.

I keep getting these two error riddled outputs for example:
duplicated numbers:
1   1   2   3   4
5   6   7   8   9
10 11 12 13 14
15 16 17 18 19
20 21 22 23 24

and ommissions

1   1   2   3   4
5   6   7   8   9
10 11 12 13 14
15 16 17 18 19
20      22 23 24


Any help would be appreciated.  I'm sorry I had to write in the code short hand style, but the computer that I am working on cannot get internet where I am at.
//assume I have an arrayList called randomList with 6000#'s 1-25
//and I have declared ints to count each time they pop up in 
//this for loop
for(int i=0;i<randList.size();i++)
{
     if(randList.get(i)==1)
          count1++;
}
for(int i=0;i<randList.size();i++)
{
     if(randList.get(i)==2)
          count1++;
}
//and so on for each number, 1-25.
int[] sortCounter = new int[25];
for(int i=0;i<sortCounter.length;i++)
{
     for(int j=0;j<randList.size();j++)
     {
           if(randList.get(i)<=randList.get(j))
                sortCounter[i]++;
     }
     //I forgot to mention that I have an arrayList of JLabels
//to store and display the results to the user in a 5*5 grid
//we will call it labelList
     int labelPos=i;
     labelPos++;//this is to display the right number to the usr
     int previous=i;
     previous--;//I use this to check the previous value
    int counterIndex=count[i]
     counterIndex--;
/*this is so the array index can't go out of bounds if the counter was incremented 25 times*/
     if(i!=0)
     {
           if(count[i]!=count[previous])         
                labelList.get(counterIndex).setText(Integer.toString(labelPos));
          else //this section takes care of ties in counters
          {
                counterIndex--;
                labelList.get(counterIndex).setText(Integer.toString(labelPos));
          }
          else//if i==0
               labelList.get(counterIndex).setText(Integer.toString(labelPos));
     }          
}

Open in new window

0
Comment
Question by:prototrumpet
11 Comments
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
You can print them out with this:
static void showFreq(List<Integer> ints) {
	int[] freqs = new int[26];
	for(Integer i : ints) {
	    freqs[i]++;
	}
	for(int i = 1;i < freqs.length;i++) {	
	    System.out.printf("%4d ", freqs[i]);
	    if(i % 5 == 0) System.out.println();	
	}
    }

Open in new window

0
 
LVL 5

Expert Comment

by:Kendor
Comment Utility
and if you would like to sort your data ascending or descending you have two options that come to my mind. use two arrays, sort one and check at which position the values initially were to get the number (this has an issue: if e.g. number 14 and 23 occured both equally...)
or you could have a small class - have a look at the posting: http://www.coderanch.com/t/451158/java/java/Helping-Sorting-Array-Doubles-But
0
 
LVL 47

Expert Comment

by:for_yan
Comment Utility

This iis my long way of doing it,
but this should print them in decreasing order

If you post the list, I'll also test it

HashMap h = new HashMap();
ArrayList uniq = new ArrayList();

for(int j=0; j<list.size(); j++){
Integer i = (Integer)list.get(j);
if(!uniq.contains(i))unig.add(i);
if(h.contains(i)){
} else
Integer ii = (Integer)h.get(i);
int inum = ii.intValue();
h.put(i,new Integer(inum+1));
{
h.put(i, new Integer(1));
}
}

HashMap nh = new HashMap();
ArrayList nu = new ArrayList();

for(int j=0; j<uniq.size(); j++){
Integer i = (Integer)uniq.get(j);

Integer ii = (Integer) h.get(i);
if(!nu.contains(ii))nu.add(ii);

if(nh.get(ii) != null){
ArrayList al = (ArrayList)nh.get(ii);
al.add(i);
}else
{
ArrayList al = new ArrayLiat();
al.add(i);
}


}

nu = Collections.sortReverse(nu);

int count = 0;
for(int jj=0; jj<nu.size(); jj++){
Integer i = (Integer) nu.get(jj);
ArrayList al = (ArayList) nh.get(i);

for(int j0=0; j0<al.size(); j0++){
System.out.println(al.get(j0) + " " + i);
count++;
}

if(count>25) break;


}

Open in new window

0
 
LVL 47

Expert Comment

by:for_yan
Comment Utility

Corrected version:
list contains integerrs

HashMap h = new HashMap();
ArrayList uniq = new ArrayList();

for(int j=0; j<list.size(); j++){
Integer i = (Integer)list.get(j);
if(!uniq.contains(i))unig.add(i);
if(h.get(i) != null){

Integer ii = (Integer)h.get(i);
int inum = ii.intValue();
h.put(i,new Integer(inum+1));
} else
{
h.put(i, new Integer(1));
}
}

HashMap nh = new HashMap();
ArrayList nu = new ArrayList();

for(int j=0; j<uniq.size(); j++){
Integer i = (Integer)uniq.get(j);

Integer ii = (Integer) h.get(i);
if(!nu.contains(ii))nu.add(ii);

if(nh.get(ii) != null){
ArrayList al = (ArrayList)nh.get(ii);
al.add(i);
nh.put(ii,al);
}else
{
ArrayList al = new ArrayLiat();
al.add(i);
nh.put(ii,al);
}


}

nu = Collections.sortReverse(nu);

int count = 0;
for(int jj=0; jj<nu.size(); jj++){
Integer i = (Integer) nu.get(jj);
ArrayList al = (ArayList) nh.get(i);

for(int j0=0; j0<al.size(); j0++){
System.out.println(al.get(j0) + " " + i);
count++;
}

if(count>25) break;


}

Open in new window

0
 

Author Comment

by:prototrumpet
Comment Utility
I managed to get Internet for the computer I was originally working on the project with.

Here attached is the actual project file in its current state.

The method in question is on line 192, makeNumberList().

I am still learning, and I have no knowledge of hashing or using trees or things like that, so I'm not sure how to implement some of your suggestions and I'm sorry about that.  If that is the only way it could be done, then I will just have to hit the books for a while.

I created this using netbeans, so if you want to see what's happening just plug it in there and run it.  First hit generate new draws, then you will see what's going on.  
lines 380 to 411 are where I am trying to set the labels based on the amount of times the numbers occurred so jumping there will save you a lot of sifting through the code.  Thanks again for your help, and I apologize for my ignorance
import java.awt.BorderLayout;
import java.awt.Color;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import java.lang.reflect.Array;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import javax.swing.JLabel;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Cash25GUI.java
 *
 * Created on Mar 20, 2011, 1:08:24 PM
 */

/**
 *
 * @author Cliff
 */
public class Cash25GUI extends javax.swing.JFrame
{

    /** Creates new form Cash25GUI */
    protected static String hotCombo1="";
    protected static String hotCombo2="";
    protected static String hotCombo3="";

    protected static String hotComboPercent1="";
    protected static String hotComboPercent2="";
    protected static String hotComboPercent3="";
    static ArrayList<JLabel> hotNumLabels = new ArrayList<JLabel>();

    static DecimalFormat fmt = new DecimalFormat("0.##");
    public Cash25GUI()
    {
        initComponents();

        
        hotNumLabels.add(n1);
        hotNumLabels.add(n2);
        hotNumLabels.add(n3);
        hotNumLabels.add(n4);
        hotNumLabels.add(n5);
        hotNumLabels.add(n6);
        hotNumLabels.add(n7);
        hotNumLabels.add(n8);
        hotNumLabels.add(n9);
        hotNumLabels.add(n10);
        hotNumLabels.add(n11);
        hotNumLabels.add(n12);
        hotNumLabels.add(n13);
        hotNumLabels.add(n14);
        hotNumLabels.add(n15);
        hotNumLabels.add(n16);
        hotNumLabels.add(n17);
        hotNumLabels.add(n18);
        hotNumLabels.add(n19);
        hotNumLabels.add(n20);
        hotNumLabels.add(n21);
        hotNumLabels.add(n22);
        hotNumLabels.add(n23);
        hotNumLabels.add(n24);
        hotNumLabels.add(n25);
        
    }
    public static void makeComboPercentFile()
    {
        FileReader fin=null;
        try
        {
            fin = new FileReader("myLetterCombos.text");
        }
        catch(IOException exception){};
        Scanner scan = new Scanner(fin);
        FileOutputStream fout=null;
        try
        {
            fout = new FileOutputStream("myComboPercents.txt");
        }
        catch(IOException exception) {};
        PrintStream printStream = new PrintStream(fout);

        ArrayList<String> myList = new ArrayList<String>();

        while(scan.hasNextLine())
            myList.add(scan.nextLine());

        String a1="";
        String b1="";
        String c1="";
        String d1="";
        String e1="";
        String f1="";
        for(int a=1;a<=4;a++)
        {
            for(int b=1;b<=4;b++)
            {
                for(int c=1;c<=4;c++)
                {
                    for(int d=1;d<=4;d++)
                    {
                      for(int e=1;e<=4;e++)
                      {
                           for(int f=1;f<=4;f++)
                           {
                                if(f>=e)
                                    if(e>=d)
                                        if(d>=c)
                                            if(c>=b)
                                                if(b>=a)
                                                {

                                                    if(a==1)
                                                        a1="A";
                                                    else if(a==2)
                                                        a1="B";
                                                    else if(a==3)
                                                        a1="C";
                                                    else if(a==4)
                                                        a1="D";
                                                    if(b==1)
                                                        b1="A";
                                                    else if(b == 2)
                                                        b1="B";
                                                    else if(b == 3)
                                                        b1="C";
                                                    else if(b == 4)
                                                        b1="D";
                                                    if(c==1)
                                                        c1="A";
                                                    else if(c == 2)
                                                        c1="B";
                                                    else if(c == 3)
                                                        c1="C";
                                                    else if(c == 4)
                                                        c1="D";
                                                    if(d==1)
                                                        d1="A";
                                                    else if(d==2)
                                                        d1="B";
                                                    else if(d==3)
                                                        d1="C";
                                                    else if(d==4)
                                                        d1="D";
                                                    if(e==1)
                                                        e1="A";
                                                    else if(e==2)
                                                        e1="B";
                                                    else if(e==3)
                                                        e1="C";
                                                    else if(e==4)
                                                        e1="D";
                                                    if(f==1)
                                                        f1="A";
                                                    else if(f==2)
                                                        f1="B";
                                                    else if(f==3)
                                                        f1="C";
                                                    else if(f==4)
                                                        f1="D";

                                                    String toCheck = a1+" "+b1+" "+c1+" "+d1+" "+e1+" "+f1;
                                                    double occurences=0;
                                                    double elements=0;

                                                    for(elements=0;elements<myList.size();elements++)
                                                    {
                                                        if(myList.get((int) elements).equals(toCheck))
                                                            occurences++;
                                                    }
                                                    double frequency = (occurences/elements)*100.0;
                                                    printStream.println(toCheck+"\n"+frequency);

                                                }
                          }
                      }
                    }
                }
            }
        }
    }
    public static void makeNumberList()
    {
        FileReader fin=null;
        try
        {
            fin = new FileReader("myFile.txt");
        }
        catch(IOException exception){};
        Scanner scan = new Scanner(fin);

        int a=0;int b=0; int c=0; int d=0; int e=0; int f=0;
        
        int one=0;int two=0;int three=0;int four=0;int five=0;
        int six=0;int seven=0;int eight=0;int nine=0;int ten=0;
        int eleven=0;int twelve=0;int thirteen=0;int fourteen=0; int fifteen=0;
        int sixteen=0;int seventeen=0;int eighteen=0; int nineteen=0;int twenty=0;
        int twentyOne=0;int twentyTwo=0;int twentyThree=0;int twentyFour=0;int twentyFive=0;

        ArrayList<Integer> tempList = new ArrayList<Integer>();
        
        
        for(int i=0;scan.hasNextLine();i++)
        {
            String line = scan.nextLine();
            int count =0;
            String tempA="";
            String tempB="";
            String tempC="";
            String tempD="";
            String tempE="";
            String tempF="";

            for(int z=0;z<=line.length();z++)
            {
                if(z==line.length())
                {
                    f=Integer.parseInt(tempF);
                }
                else
                {

                    String temp = Character.toString(line.charAt(z));
                    if(temp.equals(" ") == false && count == 0)
                    {
                        tempA=tempA+temp;

                    }
                    else if(temp.equals(" ")&&count==0)
                    {
                        a=Integer.parseInt(tempA);
                        count++;
                    }
                    else if(temp.equals(" ") == false && count == 1)
                    {
                        tempB=tempB+temp;
                    }
                    else if(temp.equals(" ")&&count==1)
                    {
                        b=Integer.parseInt(tempB);
                        count++;
                    }
                    else if(temp.equals(" ") == false && count == 2)
                    {
                        tempC=tempC+temp;
                    }
                    else if(temp.equals(" ")&&count==2)
                    {
                        c=Integer.parseInt(tempC);
                        count++;
                    }
                    else if(temp.equals(" ") == false && count == 3)
                    {
                        tempD=tempD+temp;
                    }
                    else if(temp.equals(" ")&&count==3)
                    {
                        d = Integer.parseInt(tempD);
                        count++;
                    }
                    else if(temp.equals(" ") == false && count == 4)
                    {
                        tempE=tempE+temp;
                    }
                    else if(temp.equals(" ")&&count==4)
                    {
                        e = Integer.parseInt(tempE);
                        count++;
                    }
                    else if(temp.equals(" ") == false && count == 5)
                    {
                        tempF=tempF+temp;
                    }
                }
            }
            tempList.add(a);
            tempList.add(b);
            tempList.add(c);
            tempList.add(d);
            tempList.add(e);
            tempList.add(f);
            
        }
        for(int i=0;i<tempList.size();i++)
        {
            if(tempList.get(i)==1)
                one++;
            if(tempList.get(i)==2)
                two++;
            if(tempList.get(i)==3)
                three++;
            if(tempList.get(i)==4)
                four++;
            if(tempList.get(i)==5)
                five++;
            if(tempList.get(i)==6)
                six++;
            if(tempList.get(i)==7)
                seven++;
            if(tempList.get(i)==8)
                eight++;
            if(tempList.get(i)==9)
                nine++;
            if(tempList.get(i)==10)
                ten++;
            if(tempList.get(i)==11)
                eleven++;
            if(tempList.get(i)==12)
                twelve++;
            if(tempList.get(i)==13)
                thirteen++;
            if(tempList.get(i)==14)
                fourteen++;
            if(tempList.get(i)==15)
                fifteen++;
            if(tempList.get(i)==16)
                sixteen++;
            if(tempList.get(i)==17)
                seventeen++;
            if(tempList.get(i)==18)
                eighteen++;
            if(tempList.get(i)==19)
                nineteen++;
            if(tempList.get(i)==20)
                twenty++;
            if(tempList.get(i)==21)
                twentyOne++;
            if(tempList.get(i)==22)
                twentyTwo++;
            if(tempList.get(i)==23)
                twentyThree++;
            if(tempList.get(i)==24)
                twentyFour++;
            if(tempList.get(i)==25)
                twentyFive++;


            //sort tempList into sorted List, then make a loop to assign values to hotNumList                                        
        }

        int[] count = new int[25];

        ArrayList<Integer> tempListCounter = new ArrayList<Integer>();
        tempListCounter.add(one);
        tempListCounter.add(two);
        tempListCounter.add(three);
        tempListCounter.add(four);
        tempListCounter.add(five);
        tempListCounter.add(six);
        tempListCounter.add(seven);
        tempListCounter.add(eight);
        tempListCounter.add(nine);
        tempListCounter.add(ten);
        tempListCounter.add(eleven);
        tempListCounter.add(twelve);
        tempListCounter.add(thirteen);
        tempListCounter.add(fourteen);
        tempListCounter.add(fifteen);
        tempListCounter.add(sixteen);
        tempListCounter.add(seventeen);
        tempListCounter.add(eighteen);
        tempListCounter.add(nineteen);
        tempListCounter.add(twenty);
        tempListCounter.add(twentyOne);
        tempListCounter.add(twentyTwo);
        tempListCounter.add(twentyThree);
        tempListCounter.add(twentyFour);
        tempListCounter.add(twentyFive);

        for(int i=0;i<count.length;i++)
        {

            for(int j=0;j<tempListCounter.size();j++)
            {
                if(tempListCounter.get(i)<=tempListCounter.get(j))
                {
                    
                    count[i]++;
                    
                }               
            }
            int labelI = i;
            labelI++;

            int checkI=i;
            checkI--;
            int counterIndex=count[i];
            counterIndex--;
            if(i!=0)
            {
                if(count[i]!=count[checkI])
                    hotNumLabels.get(counterIndex).setText(Integer.toString(labelI));
                else if(count[i]==count[checkI])
                {
                    counterIndex--;
                    hotNumLabels.get(counterIndex).setText(Integer.toString(labelI));
                }
            }
            else if(i == 0)
                    hotNumLabels.get(counterIndex).setText(Integer.toString(labelI));
        }
/*
        int[] biggestToSmallest= new int[25];

        for(int i=0;i<tempListCounter.size();i++)
        {
            biggestToSmallest[i]=tempListCounter.get(i);
        }
        Arrays.sort(biggestToSmallest);
        


        for(int i=biggestToSmallest.length-1;i>=0;i--)
        {
            if(biggestToSmallest[i]==one)
                hotNumLabels.get(i).setText("1");
            if(biggestToSmallest[i]==two)
                hotNumLabels.get(i).setText("2");
            if(biggestToSmallest[i]==three)
                hotNumLabels.get(i).setText("3");
            if(biggestToSmallest[i]==four)
                hotNumLabels.get(i).setText("4");
            if(biggestToSmallest[i]==five)
                hotNumLabels.get(i).setText("5");
            if(biggestToSmallest[i]==six)
                hotNumLabels.get(i).setText("6");
            if(biggestToSmallest[i]==seven)
                hotNumLabels.get(i).setText("7");
            if(biggestToSmallest[i]==eight)
                hotNumLabels.get(i).setText("8");
            if(biggestToSmallest[i]==nine)
                hotNumLabels.get(i).setText("9");
            if(biggestToSmallest[i]==ten)
                hotNumLabels.get(i).setText("10");
            if(biggestToSmallest[i]==eleven)
                hotNumLabels.get(i).setText("11");
            if(biggestToSmallest[i]==twelve)
                hotNumLabels.get(i).setText("12");
            if(biggestToSmallest[i]==thirteen)
                hotNumLabels.get(i).setText("13");
            if(biggestToSmallest[i]==fourteen)
                hotNumLabels.get(i).setText("14");
            if(biggestToSmallest[i]==fifteen)
                hotNumLabels.get(i).setText("15");
            if(biggestToSmallest[i]==sixteen)
                hotNumLabels.get(i).setText("16");
            if(biggestToSmallest[i]==seventeen)
                hotNumLabels.get(i).setText("17");
            if(biggestToSmallest[i]==eighteen)
                hotNumLabels.get(i).setText("18");
            if(biggestToSmallest[i]==nineteen)
                hotNumLabels.get(i).setText("19");
            if(biggestToSmallest[i]==twenty)
                hotNumLabels.get(i).setText("20");
            if(biggestToSmallest[i]==twentyOne)
                hotNumLabels.get(i).setText("21");
            if(biggestToSmallest[i]==twentyTwo)
                hotNumLabels.get(i).setText("22");
            if(biggestToSmallest[i]==twentyThree)
                hotNumLabels.get(i).setText("23");
            if(biggestToSmallest[i]==twentyFour)
                hotNumLabels.get(i).setText("24");
            if(biggestToSmallest[i]==twentyFive)
                hotNumLabels.get(i).setText("25");
        }*/
    }

    public static void makeLetterComboFile()
    {
        FileReader fin=null;
        try
        {
            fin = new FileReader("myFile.txt");
        }
        catch(IOException exception){};
        Scanner scan = new Scanner(fin);
        FileOutputStream fout=null;
        try
        {
            fout = new FileOutputStream("myLetterCombos.text");
        }
        catch(IOException exception) {};
        PrintStream printStream = new PrintStream(fout);

        int a=0;int b=0; int c=0; int d=0; int e=0; int f=0;
        String first=null;
        String second=null;
        String third=null;
        String fourth=null;
        String fifth=null;
        String sixth=null;

        for(int i=0;scan.hasNextLine();i++)
        {
            String line = scan.nextLine();
            int count =0;
            String tempA="";
            String tempB="";
            String tempC="";
            String tempD="";
            String tempE="";
            String tempF="";

            for(int z=0;z<=line.length();z++)
            {
                if(z==line.length())
                {
                    f=Integer.parseInt(tempF);
                }
                else
                {

                    String temp = Character.toString(line.charAt(z));
                    if(temp.equals(" ") == false && count == 0)
                    {
                        tempA=tempA+temp;

                    }
                    else if(temp.equals(" ")&&count==0)
                    {
                        a=Integer.parseInt(tempA);
                        count++;
                    }
                    else if(temp.equals(" ") == false && count == 1)
                    {
                        tempB=tempB+temp;
                    }
                    else if(temp.equals(" ")&&count==1)
                    {
                        b=Integer.parseInt(tempB);
                        count++;
                    }
                    else if(temp.equals(" ") == false && count == 2)
                    {
                        tempC=tempC+temp;
                    }
                    else if(temp.equals(" ")&&count==2)
                    {
                        c=Integer.parseInt(tempC);
                        count++;
                    }
                    else if(temp.equals(" ") == false && count == 3)
                    {
                        tempD=tempD+temp;
                    }
                    else if(temp.equals(" ")&&count==3)
                    {
                        d = Integer.parseInt(tempD);
                        count++;
                    }
                    else if(temp.equals(" ") == false && count == 4)
                    {
                        tempE=tempE+temp;
                    }
                    else if(temp.equals(" ")&&count==4)
                    {
                        e = Integer.parseInt(tempE);
                        count++;
                    }
                    else if(temp.equals(" ") == false && count == 5)
                    {
                        tempF=tempF+temp;
                    }
                }
            }

            if(a<7)
                first="A";
            else if(a<13)
                first="B";
            else if(a<19)
                first="C";
            else
                first="D";

            if(b<7)
                second="A";
            else if(b<13)
                second="B";
            else if(b<19)
                second="C";
            else
                second="D";

            if(c<7)
                third="A";
            else if(c<13)
                third="B";
            else if(c<19)
                third="C";
            else
                third="D";

            if(d<7)
                fourth="A";
            else if(d<13)
                fourth="B";
            else if(d<19)
                fourth="C";
            else
                fourth="D";

            if(e<7)
                fifth="A";
            else if(e<13)
                fifth="B";
            else if(e<19)
                fifth="C";
            else
                fifth="D";

            if(f<7)
                sixth="A";
            else if(f<13)
                sixth="B";
            else if(f<19)
                sixth="C";
            else
                sixth="D";

            printStream.println(first+" "+second+" "+third+" "+fourth+" "+fifth+" "+sixth);
        }
    }
    public static void makeHotCombos()
    {
        FileReader fin=null;
        try
        {
            fin = new FileReader("myComboPercents.txt");
        }
        catch(IOException exception){};
        Scanner scan = new Scanner(fin);
        ArrayList<String> myList = new ArrayList<String>();

        while(scan.hasNextLine())
            myList.add(scan.nextLine());

        String biggest1="";
        String biggest2="";
        String biggest3="";

        double biggestPercent1=0;
        double biggestPercent2=0;
        double biggestPercent3=0;

        for(int i=0;i<myList.size()-1;i++)
        {
            String combo = myList.get(i);
            double comboPercent = Double.parseDouble(myList.get(++i));

            if(comboPercent>=biggestPercent1)
            {
                biggest3=biggest2;
                biggestPercent3=biggestPercent2;

                biggest2=biggest1;
                biggestPercent2=biggestPercent1;

                biggest1=combo;
                biggestPercent1=comboPercent;
            }
            else if(comboPercent>=biggestPercent2)
            {
                biggest3=biggest2;
                biggestPercent3=biggestPercent2;

                biggest2=combo;
                biggestPercent2=comboPercent;
            }
            else if(comboPercent>=biggestPercent3)
            {
                biggest3=combo;
                biggestPercent3=comboPercent;
            }
        }
        hotCombo1=biggest1;
        hotCombo2=biggest2;
        hotCombo3=biggest3;
        hotComboPercent1 = fmt.format(biggestPercent1);
        hotComboPercent2 = fmt.format(biggestPercent2);
        hotComboPercent3 = fmt.format(biggestPercent3);
    }

    public static void setHotCombos()
    {
        makeHotCombos();
        hotComboLabel1.setText(hotCombo1);
        hotComboLabel2.setText(hotCombo2);
        hotComboLabel3.setText(hotCombo3);

        hotComboPercentLabel1.setText(hotComboPercent1+" %");
        hotComboPercentLabel2.setText(hotComboPercent2+" %");
        hotComboPercentLabel3.setText(hotComboPercent3+" %");


    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        generateNewNumbers = new javax.swing.JButton();
        checkNumbers = new javax.swing.JButton();
        num1 = new javax.swing.JTextField();
        num2 = new javax.swing.JTextField();
        num4 = new javax.swing.JTextField();
        num3 = new javax.swing.JTextField();
        num5 = new javax.swing.JTextField();
        num6 = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        hitLabel1 = new javax.swing.JLabel();
        hitLabel2 = new javax.swing.JLabel();
        hitLabel3 = new javax.swing.JLabel();
        hitLabel4 = new javax.swing.JLabel();
        hitLabel5 = new javax.swing.JLabel();
        hitLabel6 = new javax.swing.JLabel();
        tipLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        hotComboLabel1 = new javax.swing.JLabel();
        hotComboPercentLabel1 = new javax.swing.JLabel();
        hotComboLabel2 = new javax.swing.JLabel();
        hotComboPercentLabel2 = new javax.swing.JLabel();
        hotComboLabel3 = new javax.swing.JLabel();
        hotComboPercentLabel3 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        n1 = new javax.swing.JLabel();
        n5 = new javax.swing.JLabel();
        n4 = new javax.swing.JLabel();
        n3 = new javax.swing.JLabel();
        n2 = new javax.swing.JLabel();
        n10 = new javax.swing.JLabel();
        n6 = new javax.swing.JLabel();
        n8 = new javax.swing.JLabel();
        n7 = new javax.swing.JLabel();
        n9 = new javax.swing.JLabel();
        n14 = new javax.swing.JLabel();
        n11 = new javax.swing.JLabel();
        n12 = new javax.swing.JLabel();
        n15 = new javax.swing.JLabel();
        n13 = new javax.swing.JLabel();
        n20 = new javax.swing.JLabel();
        n16 = new javax.swing.JLabel();
        n18 = new javax.swing.JLabel();
        n19 = new javax.swing.JLabel();
        n17 = new javax.swing.JLabel();
        n21 = new javax.swing.JLabel();
        n22 = new javax.swing.JLabel();
        n24 = new javax.swing.JLabel();
        n23 = new javax.swing.JLabel();
        n25 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Cash 25 Simulator");

        generateNewNumbers.setFont(new java.awt.Font("Lucida Grande", 0, 18));
        generateNewNumbers.setText("Generate New Draws");
        generateNewNumbers.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                generateNewNumbersActionPerformed(evt);
            }
        });

        checkNumbers.setFont(new java.awt.Font("Lucida Grande", 0, 18));
        checkNumbers.setText("Check My Numbes");
        checkNumbers.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkNumbersActionPerformed(evt);
            }
        });

        num1.setFont(new java.awt.Font("Lucida Grande", 0, 24));
        num1.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        num1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                num1ActionPerformed(evt);
            }
        });

        num2.setFont(new java.awt.Font("Lucida Grande", 0, 24));
        num2.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        num2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                num2ActionPerformed(evt);
            }
        });

        num4.setFont(new java.awt.Font("Lucida Grande", 0, 24));
        num4.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        num4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                num4ActionPerformed(evt);
            }
        });

        num3.setFont(new java.awt.Font("Lucida Grande", 0, 24));
        num3.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        num3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                num3ActionPerformed(evt);
            }
        });

        num5.setFont(new java.awt.Font("Lucida Grande", 0, 24));
        num5.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        num5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                num5ActionPerformed(evt);
            }
        });

        num6.setFont(new java.awt.Font("Lucida Grande", 0, 24));
        num6.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        num6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                num6ActionPerformed(evt);
            }
        });

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Enter a number from 1 - 25 in each field, then hit the check numbers button to get");

        tipLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        tipLabel1.setText("Not hitting much?  Tip: A = 1-6, B = 7-12, C = 13 - 18, and D = 19 - 25.");

        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel2.setText("Combinations in these formats are hot!");

        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel3.setText("the percentage of times the numbers hit in 1000 different draws");

        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel4.setText("Here are all 25 numbers from hot to cold");

        n1.setForeground(new java.awt.Color(255, 0, 51));
        n1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n5.setForeground(new java.awt.Color(255, 0, 51));
        n5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n4.setForeground(new java.awt.Color(255, 0, 51));
        n4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n3.setForeground(new java.awt.Color(255, 0, 51));
        n3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n2.setForeground(new java.awt.Color(255, 0, 51));
        n2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n10.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n8.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n9.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n14.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n12.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n15.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n13.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n20.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n16.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n18.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n19.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n17.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n21.setForeground(new java.awt.Color(0, 51, 255));
        n21.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n22.setForeground(new java.awt.Color(0, 51, 255));
        n22.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n24.setForeground(new java.awt.Color(0, 51, 255));
        n24.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n23.setForeground(new java.awt.Color(0, 51, 255));
        n23.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        n25.setForeground(new java.awt.Color(0, 51, 255));
        n25.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(n1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(n6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n8, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(n11, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n13, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(n16, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n17, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n18, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(n21, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n22, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n24, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(n25, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(36, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(n5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(n10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n8, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(n15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n13, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n11, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(n20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n18, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n17, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n16, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(n25, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n24, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n22, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(n21, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap(49, Short.MAX_VALUE)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(layout.createSequentialGroup()
                        .add(generateNewNumbers, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 283, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .add(checkNumbers, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 283, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(hitLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(num1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 91, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(18, 18, 18)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                            .add(hitLabel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(num2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE))
                        .add(18, 18, 18)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                            .add(hitLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(num3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE))
                        .add(18, 18, 18)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                            .add(hitLabel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(num4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE))
                        .add(18, 18, 18)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                            .add(hitLabel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(num5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE))
                        .add(18, 18, 18)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(hitLabel6, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(num6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 91, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                .add(47, 47, 47))
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .add(29, 29, 29)
                .add(tipLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 683, Short.MAX_VALUE)
                .addContainerGap())
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 346, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jLabel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 332, Short.MAX_VALUE)
                .addContainerGap())
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 692, Short.MAX_VALUE)
                    .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 692, Short.MAX_VALUE))
                .addContainerGap())
            .add(layout.createSequentialGroup()
                .add(104, 104, 104)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(hotComboLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 181, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(106, 106, 106)
                        .add(jLabel5))
                    .add(hotComboPercentLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 181, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(hotComboLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 181, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(hotComboPercentLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 181, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(hotComboLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 181, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(hotComboPercentLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 181, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(18, 18, 18)
                .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(25, 25, 25)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(generateNewNumbers, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 58, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(checkNumbers, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 58, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(15, 15, 15)
                .add(jLabel1)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel3)
                .add(18, 18, 18)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(num1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(num2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(num3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(num4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(num5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(num6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(hitLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 34, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(hitLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 34, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(hitLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 34, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(hitLabel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 34, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(hitLabel5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 34, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(hitLabel6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 34, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(tipLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 24, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel2)
                    .add(jLabel4))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                    .add(layout.createSequentialGroup()
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                            .add(jLabel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(hotComboLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(hotComboPercentLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(hotComboLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(hotComboPercentLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(hotComboLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(hotComboPercentLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>                        

    private void generateNewNumbersActionPerformed(java.awt.event.ActionEvent evt) {                                                   
        Cash25();
        setHotCombos();
        makeNumberList();
    }                                                  

    private void checkNumbersActionPerformed(java.awt.event.ActionEvent evt) {                                             
        String aIn = num1.getText();
        String bIn = num2.getText();
        String cIn = num3.getText();
        String dIn = num4.getText();
        String eIn = num5.getText();
        String fIn = num6.getText();

        FileReader fin=null;
        try
        {
            fin = new FileReader("myFile.txt");
        }
        catch(IOException exception){};
        Scanner scan = new Scanner(fin);


        int a=0;int b=0; int c=0; int d=0; int e=0; int f=0;
        
        int acount = 0;
        int bcount = 0;
        int ccount = 0;
        int dcount = 0;
        int ecount = 0;
        int fcount = 0;
        ArrayList<Integer> myList = new ArrayList<Integer>();
        for(int i=0;scan.hasNextLine();i++)
        {
            String line = scan.nextLine();
            int count =0;
            String tempA="";
            String tempB="";
            String tempC="";
            String tempD="";
            String tempE="";
            String tempF="";



            for(int z=0;z<=line.length();z++)
            {
                if(z==line.length())
                {
                    f=Integer.parseInt(tempF);
                }
                else
                {

                    String temp = Character.toString(line.charAt(z));
                    if(temp.equals(" ") == false && count == 0)
                    {
                        tempA=tempA+temp;

                    }
                    else if(temp.equals(" ")&&count==0)
                    {
                        a=Integer.parseInt(tempA);
                        count++;
                    }
                    else if(temp.equals(" ") == false && count == 1)
                    {
                        tempB=tempB+temp;
                    }
                    else if(temp.equals(" ")&&count==1)
                    {
                        b=Integer.parseInt(tempB);
                        count++;
                    }
                    else if(temp.equals(" ") == false && count == 2)
                    {
                        tempC=tempC+temp;
                    }
                    else if(temp.equals(" ")&&count==2)
                    {
                        c=Integer.parseInt(tempC);
                        count++;
                    }
                    else if(temp.equals(" ") == false && count == 3)
                    {
                        tempD=tempD+temp;
                    }
                    else if(temp.equals(" ")&&count==3)
                    {
                        d = Integer.parseInt(tempD);
                        count++;
                    }
                    else if(temp.equals(" ") == false && count == 4)
                    {
                        tempE=tempE+temp;
                    }
                    else if(temp.equals(" ")&&count==4)
                    {
                        e = Integer.parseInt(tempE);
                        count++;
                    }
                    else if(temp.equals(" ") == false && count == 5)
                    {
                        tempF=tempF+temp;
                    }
                }
            }

            myList.add(a);
            myList.add(b);
            myList.add(c);
            myList.add(d);
            myList.add(e);
            myList.add(f);
        }

        for(int i=0;i<myList.size();i++)
        {
            System.out.println(myList.get(i));
            if(myList.get(i)==Integer.parseInt(aIn))
                acount++;
            if(myList.get(i)==Integer.parseInt(bIn))
                bcount++;
            if(myList.get(i)==Integer.parseInt(cIn))
                ccount++;
            if(myList.get(i)==Integer.parseInt(dIn))
                dcount++;
            if(myList.get(i)==Integer.parseInt(eIn))
                ecount++;
            if(myList.get(i)==Integer.parseInt(fIn))
                fcount++;
        }
       
        if(acount>0)
            num1.setBackground(Color.green);
        if(bcount>0)
            num2.setBackground(Color.green);
        if(ccount>0)
            num3.setBackground(Color.green);
        if(dcount>0)
            num4.setBackground(Color.green);
        if(ecount>0)
            num5.setBackground(Color.green);
        if(fcount>0)
            num6.setBackground(Color.green);

        hitLabel1.setText(fmt.format(acount/10)+" %");
        hitLabel2.setText(fmt.format(bcount/10)+" %");
        hitLabel3.setText(fmt.format(ccount/10)+" %");
        hitLabel4.setText(fmt.format(dcount/10)+" %");
        hitLabel5.setText(fmt.format(ecount/10)+" %");
        hitLabel6.setText(fmt.format(fcount/10)+" %");
    }                                            

    private void num1ActionPerformed(java.awt.event.ActionEvent evt) {                                     
        // TODO add your handling code here:
    }                                    

    private void num2ActionPerformed(java.awt.event.ActionEvent evt) {                                     
        // TODO add your handling code here:
    }                                    

    private void num4ActionPerformed(java.awt.event.ActionEvent evt) {                                     
        // TODO add your handling code here:
    }                                    

    private void num3ActionPerformed(java.awt.event.ActionEvent evt) {                                     
        // TODO add your handling code here:
    }                                    

    private void num5ActionPerformed(java.awt.event.ActionEvent evt) {                                     
        // TODO add your handling code here:
    }                                    

    private void num6ActionPerformed(java.awt.event.ActionEvent evt) {                                     
        // TODO add your handling code here:
    }                                    

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Cash25GUI().setVisible(true);
            }
        });
    }
    public static void Cash25()
    {
        
        MakeRandomDraws myDraws = new MakeRandomDraws();
        myDraws.makeRandomDrawsFile();
        makeLetterComboFile();
        makeComboPercentFile();
    }

    // Variables declaration - do not modify                     
    private javax.swing.JButton checkNumbers;
    private javax.swing.JButton generateNewNumbers;
    private javax.swing.JLabel hitLabel1;
    private javax.swing.JLabel hitLabel2;
    private javax.swing.JLabel hitLabel3;
    private javax.swing.JLabel hitLabel4;
    private javax.swing.JLabel hitLabel5;
    private javax.swing.JLabel hitLabel6;
    private static javax.swing.JLabel hotComboLabel1;
    private static javax.swing.JLabel hotComboLabel2;
    private static javax.swing.JLabel hotComboLabel3;
    private static javax.swing.JLabel hotComboPercentLabel1;
    private static javax.swing.JLabel hotComboPercentLabel2;
    private static javax.swing.JLabel hotComboPercentLabel3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JLabel n1;
    private javax.swing.JLabel n10;
    private javax.swing.JLabel n11;
    private javax.swing.JLabel n12;
    private javax.swing.JLabel n13;
    private javax.swing.JLabel n14;
    private javax.swing.JLabel n15;
    private javax.swing.JLabel n16;
    private javax.swing.JLabel n17;
    private javax.swing.JLabel n18;
    private javax.swing.JLabel n19;
    private javax.swing.JLabel n2;
    private javax.swing.JLabel n20;
    private javax.swing.JLabel n21;
    private javax.swing.JLabel n22;
    private javax.swing.JLabel n23;
    private javax.swing.JLabel n24;
    private javax.swing.JLabel n25;
    private javax.swing.JLabel n3;
    private javax.swing.JLabel n4;
    private javax.swing.JLabel n5;
    private javax.swing.JLabel n6;
    private javax.swing.JLabel n7;
    private javax.swing.JLabel n8;
    private javax.swing.JLabel n9;
    private javax.swing.JTextField num1;
    private javax.swing.JTextField num2;
    private javax.swing.JTextField num3;
    private javax.swing.JTextField num4;
    private javax.swing.JTextField num5;
    private javax.swing.JTextField num6;
    private javax.swing.JLabel tipLabel1;
    // End of variables declaration                   

}

Open in new window

0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 47

Expert Comment

by:for_yan
Comment Utility
Do you have the list of numbers which you need to count ocurrences;
can you post just that list?
0
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 500 total points
Comment Utility

This is the code which I tested:

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;


public class CountIntOccurences {

    public CountIntOccurences(){

      ArrayList list = null;
        list = new ArrayList();

 int [] myInt = {2,3,4,4,4,5,5,3};
        for(int j=0; j<myInt.length; j++){
            list.add(new Integer(myInt[j]));
        }

HashMap h = new HashMap();
ArrayList uniq = new ArrayList();

for(int j=0; j<list.size(); j++){
Integer i = (Integer)list.get(j);
if(!uniq.contains(i))uniq.add(i);
if(h.get(i) != null){

Integer ii = (Integer)h.get(i);
int inum = ii.intValue();
h.put(i,new Integer(inum+1));
} else
{
h.put(i, new Integer(1));
}
}

HashMap nh = new HashMap();
ArrayList nu = new ArrayList();

for(int j=0; j<uniq.size(); j++){
Integer i = (Integer)uniq.get(j);

Integer ii = (Integer) h.get(i);
if(!nu.contains(ii))nu.add(ii);

if(nh.get(ii) != null){
ArrayList al = (ArrayList)nh.get(ii);
al.add(i);
nh.put(ii,al);
}else
{
ArrayList al = new ArrayList();
al.add(i);
nh.put(ii,al);
}


}

Collections.sort(nu);

Collections.reverse(nu);

int count = 0;
for(int jj=0; jj<nu.size(); jj++){
Integer i = (Integer) nu.get(jj);
ArrayList al = (ArrayList) nh.get(i);

for(int j0=0; j0<al.size(); j0++){
System.out.println(al.get(j0) + " " + i);
count++;
}

if(count>25) break;


}


    }

  public static void main(String [] args){

      new CountIntOccurences();
  }

}

Open in new window


This is the result:

4 3
3 2
5 2
2 1

Open in new window



Paste your own list and check.
Let me know if you have any questions
0
 

Author Comment

by:prototrumpet
Comment Utility
Here is my List, its a text file that I read with the method.

by hitting the generate new draws button, you can make your own when you run the file though
myfile.txt
0
 
LVL 47

Accepted Solution

by:
for_yan earned 500 total points
Comment Utility

There you go:

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.StringTokenizer;


public class CountIntOccurences {

    public CountIntOccurences(){

      ArrayList list = null;
        list = new ArrayList();

        try {
            DataInputStream in = new DataInputStream(new FileInputStream("C:\\temp\\test\\myIntList.txt"));

            String buff = null;
            while((buff=in.readLine()) != null){
                StringTokenizer t = new StringTokenizer(buff);
                while(t.hasMoreTokens())list.add(new Integer(t.nextToken()));

            }

        }  catch(Exception ex){
            System.out.println(ex.toString());
                    ex.printStackTrace();
        }
         /*
 int [] myInt = {2,3,4,4,4,5,5,3};
        for(int j=0; j<myInt.length; j++){
            list.add(new Integer(myInt[j]));
        }
        */

HashMap h = new HashMap();
ArrayList uniq = new ArrayList();

for(int j=0; j<list.size(); j++){
Integer i = (Integer)list.get(j);
if(!uniq.contains(i))uniq.add(i);
if(h.get(i) != null){

Integer ii = (Integer)h.get(i);
int inum = ii.intValue();
h.put(i,new Integer(inum+1));
} else
{
h.put(i, new Integer(1));
}
}

HashMap nh = new HashMap();
ArrayList nu = new ArrayList();

for(int j=0; j<uniq.size(); j++){
Integer i = (Integer)uniq.get(j);

Integer ii = (Integer) h.get(i);
if(!nu.contains(ii))nu.add(ii);

if(nh.get(ii) != null){
ArrayList al = (ArrayList)nh.get(ii);
al.add(i);
nh.put(ii,al);
}else
{
ArrayList al = new ArrayList();
al.add(i);
nh.put(ii,al);
}


}

Collections.sort(nu);

Collections.reverse(nu);

int count = 0;
for(int jj=0; jj<nu.size(); jj++){
Integer i = (Integer) nu.get(jj);
ArrayList al = (ArrayList) nh.get(i);

for(int j0=0; j0<al.size(); j0++){
System.out.println(al.get(j0) + " " + i);
count++;
}

if(count>25) break;


}


    }

  public static void main(String [] args){

      new CountIntOccurences();
  }

}

Open in new window


Result (even checked with the editor - indeed 816 occurences of 25):

25 816
24 814
23 740
22 618
21 482
20 412
19 264
18 235
17 182
16 175
15 144
14 119
13 117
12 105
11 96
9 90
10 89
8 79
5 74
6 69
7 63
4 63
1 54
3 52
2 48

Open in new window

0
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 500 total points
Comment Utility
Explanation of the above code:

First we read the file and make ArrayList list

Then we create HashMap called "h" -
it has your integers as keys and number of occurrences for each integer as values

Simulatneously we create ArrayList "uniq" whaich has all your integers but each one only one time - just dsitinct integers
In fact this is the list of keys of hashMap "h"

Then we go second time and make another HashMap "nh"
This one has frequencies as keys and ArrayList's conatining all integers which have such fequency as a value

Simulatebnously creating ArrayList of frequencies - the keys to HashMap nh

Then we sort list of frequencies - from low to high (Collections.sort)
Then we reverse this list Collections, reverse)

then we go therough the list of frequencies from hig to low
and for each frequency retrieve ArrayList of integers which have such frequency
and print the pairs - first integer - then frequecy

Count the numre of rows if after some frequency we have more than 25 rows - stop printing
You may happen to have more than 25 rows in case the same frequency applies to several integers

Let me know if you have any questions.
To understand this you just need to know what is ArrayList and what is HashMap - nothing else




0
 

Author Comment

by:prototrumpet
Comment Utility
It works!!!

Thanks Everyone!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Iteration: Iteration is repetition of a process. A student who goes to school repeats the process of going to school everyday until graduation. We go to grocery store at least once or twice a month to buy products. We repeat this process every mont…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now