A contestant is said to be a winner if his number is strictly greater than the numbers to his left and his right and a contestant is said to be a loser if his number is strictly less than the numbers to his left and right so the contestant are on a circle and I should calculate the number of winners and losers.Please help in evaluating my solution and correcting it.            int winner=0;        int loser=0;        for (int i = 0; i < contestant.length; i++) {            if (i == 0) {                if (contestant[0] < contestant[contestant.length - 1]                        && contestant[0] < contestant[1])                    loser++;                else if (contestant[0] > contestant[contestant.length - 1]                        && contestant[0] > contestant[1])                    winner++;            } else if (i == contestant.length - 1) {                if (contestant[0] > contestant[contestant.length - 1]                        && contestant[contestant.length - 2] > contestant[contestant.length - 1])                    loser++;                else if (contestant[0] < contestant[contestant.length - 1]                        && contestant[contestant.length - 2] < contestant[contestant.length - 1])                    winner++;            } else {                if (contestant[i] < contestant[i + 1] &&contestant[i] < contestant[i - 1])                    loser++;                else if (contestant[i] > contestant[i + 1]                        && contestant[i] > contestant[i - 1])                    winner++;            }        }
Calculating the number of winners and losers
java;array