package ru.matevosyan;

/**
 * Created BiggerRepeatValue fo finding bigger repeating number in array.
 * Created on 25.01.2017.
 * @since 1.0
 * @author Matevosyan Vardan
 * @version 1.0
 */

public class BiggerRepeatValue {

    /**
     * Create to find bigger repeating value.
     * @param intNumbers array with which we find bigger number
     * @return <code>maxCount</code>
     */

    public int findRepeatValues(int[] intNumbers) {
        int countFor = 1;
        int maxCount = 0;
        int number = 0;

        for (int i = 0; i < intNumbers.length - 1; i++) {

            if (intNumbers[i] == intNumbers[i + 1]) {
                countFor++;
                if (maxCount < countFor) {
                    maxCount = countFor;
                    number = intNumbers[i];
                }

            } else {
                countFor = 1;
            }
        }
        System.out.println("Number" + number + "repeat" + maxCount + "times");
        return maxCount;
    }
}

create BiggerRepeatValue to find bigger repeating value in array