Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TestLabels {
- public static void main(String[] args) {
- testLabel();
- }
- private static void testLabel() {
- int[][] array = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}};
- int toFind = 2;
- searchItem:
- for (int i = 0; i < array.length; i++) {
- for (int j = 0; j < array[i].length; j++) {
- System.out.println(String.format("looking at at %s, %s", i, j));
- if (array[i][j] == toFind) {
- System.out.println(String.format("found at %s, %s", i, j));
- break searchItem;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement