Matriz de java repitiendo

int num=5, veses=2, encontrado=0, arr[4,5,2,4,5,9,9,4,4];
boolean success=false;
for (int i=0, i < arr.lenth; i++){
	if(arr[i]==num){
    encontrado++;
	}
}
if(encontrado>=veses){
success = true;
}
Victorious Vicuña