Method that compares the scores of two players I tackled this problem today and was wondering how I could possibly improve this code.
The objective of the method is to return an array with the respective scores of each player. The method takes three values from 2 users. a0,a1,a2 are all scores from player a. b0,b1,b2 are all scores of player b.

A player is awarded a point if their score of the same category is bigger than the score of the player.
For example to determine who got a better first score we must compare a0 with b0 and so on forth.

Here is my code:  

static int[] solve(int a0, int a1, int a2, int b0, int b1, int b2){
        int p1 = 0;
        int p2 = 0;
        if(a0 &gt; b0){
            p1++;
        }else if(a0 &lt; b0){
            p2++;
        }

        if(a1 &gt; b1){
            p1++;
        }else if(a1 &lt; b1){
            p2++;
        }

        if(a2 &gt; b2){
            p1++;
        }else if(a2 &lt; b2){
            p2++;
        }

        return new int[]{p1,p2};

    }
As Timothy mentioned, your naming of the variables are not so good. I would recommend you have a look at Java Naming Conventions. It will be helpful for writing easily readable codes.

Secondly, try using private for your method. I know it is not a big program, but you will get used to it.

Thirdly, the beauty of the code is in shortness and effectiveness. And here I took Timothy's code and wrote it with for loop:

int[] scoresOfPlayerA = new int[]{a0,a1,a2};
int[] scoresOfPlayerB = new int[]{b0,b1,b2};

for (int i = 0; i &lt; scoresOfPlayerA.length; i++){
    if (scoresOfPlayerA[i] &gt; scoresOfPlayerB[i]){
        finalScoreOfA++;
    } else if (scoresOfPlayerA[i] &lt; scoresOfPlayerB[i]) {
        finalScoreOfB++;
    }
}

return new int[]{finalScoreOfA, finalScoreOfB};


Good luck with your future codes.