public class CariAngka {
public static void main(String[] args) {
int[][] arrayOfInts = {
{ 32, 87, 3, 589 },
{ 12, 1076, 2000, 8 },
{ 622, 127, 77, 955 }
};
int target = 12;
boolean found = false;
int rowPosition = -1;
int colPosition = -1;
outerLoop:
for (int i = 0; i < arrayOfInts.length; i++) {
for (int j = 0; j < arrayOfInts[i].length; j++) {
if (arrayOfInts[i][j] == target) {
found = true;
rowPosition = i;
colPosition = j;
break outerLoop; // Menghentikan looping luar
}
}
}
if (found) {
System.out.println("Found " + target + " at " + rowPosition + ", " + colPosition);
} else {
System.out.println(target + " not found in the array");
}
}
}