public static boolean doit(int[][] a, int b){
for(int i=0; i<a.length; i++){
for (int j = 0; j < a[i].length; j++)
{
if(a[i][j] ==b) {
return true;
}
}
}
return false;
}
So basically I want to use the ForEach loop, for checking if the array contains the int b, but I'm not sure how to use it.
public static boolean doitTwo(int[][] a, int b){
for(c :a){
for ( d:a){
if(a[c][d] ==b) {
return true;
}
}
}
}