public static int countIn2DArray(int[][] twoDArray, int target)
{
int count = 0;
for (int row = 0; row < twoDArray.length; row++) {
for (int i = 0; i < twoDArray[row].length; i++) {
if (twoDArray[row][i] == target)
count++;
}
}
return count;
}
public static String searchIn2DArray(int[][] twoDArray, int target)
{
int targetRow = -1;
int targetColumn = -1;
for (int row = 0; row < twoDArray.length; row++) {
for (int i = 0; i < twoDArray[row].length; i++) {
if (twoDArray[row][i] == target) {
targetRow = row;
targetColumn = i;
}
}
}
return "The coordinates of the target value is " + targetRow + ", " + targetColumn;
}