package test;
public class Main {
static private int max = 0;
public static void main(String[] args) {
Integer arr[] = {1,1,3,3,3,3,3,3,3,3};
maxNumRepeated(arr,3);
System.out.println(max);
}
public static void maxNumRepeated(Integer[] a, int elem) {
int cont = 1;
int maxNum = 0;
if (a.length == 1 && a[0].equals(elem)) {
maxNum = 1;
max = maxNum;
} else if (a.length == 0) {
maxNum = 0;
max = maxNum;
} else {
for (int i = 0; i
if (a[i].equals(elem)) {
maxNum = 1;
if (a[i].equals(a[i + 1])) {
cont++;
maxNum = cont;
if(maxNum>max){
max = maxNum;
}
}else{
if(maxNum>max){
max = maxNum;
}
maxNum = 0;
cont = 1;
}
}
}
}
}
}