java program for poerball lottery : I have to check all test cases which i have given in arrays but i am not getting perfect answer.Please help me with this question.Create a PowerBall class that contains:
 - A field for an int array of size 6. 
 - A constructor that initializes this array with 6 random values (0-9). 
 - A method called checkMatch that takes as an argument an int array and returns how many numbers match the class's int array. To match, the same numbers must be in the same position.

Write a main class which asks to user to enter 6 numbers as their lottery ticket and store it in an array. Then create a PowerBall object and give the user's ticket to the checkMatch method. Then figure out the amount won based on the return value.

The winnings are determined as follows:
If 0 numbers match, no winnings
If 1 number matches, win $4
If 2 numbers match, win $7
If 3 numbers match, win $100
If 4 numbers match, win $10,000
If 5 numbers match, win $1 Million
If all 6 numbers match, win Grand Prize of $450 Million

Output the user's lottery ticket, the powerball numbers, how many matched, and the amount of money won. (JAVA PROGRAM HELP)




class PowerBall {
    /*
     * ALL PRIVATE DATA BELOW
     */

    private int[] winningNumber;
    private int[] ticketNumber;
    private long cash;
    static private IntUtil u = new IntUtil();
    int matchBalCount ;
    int powerBallMatchCount;

    public int cash() {
        
        for (int i = 0; i < winningNumber.length; i++) {
            for (int j = 0; j < ticketNumber.length; j++) {
                if (i == winningNumber.length-1 && ticketNumber[i] == winningNumber[j]) {
                    powerBallMatchCount=1;
                } else if (ticketNumber[i] == winningNumber[j]) {
                    matchBalCount++;
                }
            }
    
            }
        return 100;
    }
   

    public void check(int matchBalCount,int powerBalCount){
        
        System.out.println("prize---matchBalCount::"+matchBalCount+" ,powerBallMatchCount::"+powerBallMatchCount);
        if (matchBalCount == 0 && powerBallMatchCount>0) {
            System.out.println("4");
        }else if (matchBalCount == 1 && powerBallMatchCount>0) {
            System.out.println("4");
        }else if (matchBalCount == 2 && powerBallMatchCount>0) {
            System.out.println("7");
        }else if (matchBalCount == 3 && powerBallMatchCount<0) {
            System.out.println("7");
        }else if (matchBalCount == 3&& powerBallMatchCount>0) {
            System.out.println("100");
        }else if (matchBalCount == 4 && powerBallMatchCount<0) {
            System.out.println("100");
        }else if (matchBalCount == 4 && powerBallMatchCount>0) {
            System.out.println("50000");
        }else if (matchBalCount == 5 && powerBallMatchCount>0) {
            System.out.println("1lakh");
        } 
     
     
    }
 

    PowerBall(int[] w, int[] t) {
        winningNumber = w;
        ticketNumber = t;
        cash = 0;
     check(matchBalCount,powerBallMatchCount);
    }

    private static void test1() {
        int[] w = {4, 8, 19, 27, 24, 10};
        {
            int[] n = {4, 8, 19, 27, 24, 10};
            PowerBall x = new PowerBall(w, n);
           // x.cash();
        }
        {
            int[] n = {24, 27, 19, 8, 4, 10};
            PowerBall x = new PowerBall(w, n);
        }
        {
            int[] n = {24, 27, 19, 8, 4, 5};
            PowerBall x = new PowerBall(w, n);
        }
        {
            int[] n = {124, 127, 119, 18, 14, 10};
            PowerBall x = new PowerBall(w, n);
        }
        {
            int[] n = {124, 127, 119, 18, 14, 5};
            PowerBall x = new PowerBall(w, n);
        }
        {
            int[] n = {124, 127, 119, 18, 14};
            PowerBall x = new PowerBall(w, n);
        }
        {
            int[] n = {124, 124, 19, 119, 18, 14};
            PowerBall x = new PowerBall(w, n);
        }
    }

    private static void testRandom() {
        int[] w = {4, 8, 19, 27, 24, 10};
        int max = 10;
        long c = 0;
        for (int i = 0; i < max; ++i) {
            int[] n = u.generateRandomNumber(6, true, 1, 99);
            PowerBall x = new PowerBall(w, n);
            c = c + x.cash();
        }
        System.out.println("Out of " + max + " times you win " + c + "$");
    }

    private static void testBench() {
        test1();
        testRandom();
    }

    public static void main(String[] args) {
        System.out.println("PowerBall.java");
        testBench();
        System.out.println("Done");
    }

}