Im trying to identify number patterns in which a number is repeated 4 times in a row in a 2 dimensional array, i have came up with only identifying horizontally and vertically, could anyone please help me on identifying number patterns for diagonally and number patterns that occur more then once (either vertically with horizontal or vice versa) in a table of 6 rows and 7 columns

the number patterns are

pattern1.txt

0 1 0 3 1 6 1 

0 1 6 8 6 0 1

5 6 2 1 8 2 9

6 5 3 3 3 3 1

1 3 6 1 4 0 7

6 1 1 9 4 0 7

pattern2.txt

0 1 0 3 1 6 1

0 1 6 5 6 8 1

5 0 2 5 8 1 9

6 2 6 5 1 1 1

1 9 6 5 4 1 7

3 0 3 3 4 0 7

pattern3.txt

0 1 0 3 1 6 1

0 1 6 8 6 0 1

5 6 2 1 6 2 9

6 5 6 6 1 9 1

1 3 6 1 4 0 7

3 6 3 3 4 0 7

pattern4.txt

0 1 0 3 1 6 1

0 1 6 8 6 0 1

9 6 2 1 8 2 9

6 9 6 1 1 9 1

1 3 9 1 4 0 7

3 3 3 9 4 0 7

pattern5.txt

0 1 0 3 1 6 1

0 1 6 8 6 0 1

9 6 2 1 8 2 9

6 0 6 1 1 9 1

1 3 9 1 4 0 7

3 3 6 7 4 0 7

pattern6.txt

0 1 0 3 1 6 1

0 1 6 8 3 0 1

9 6 2 1 8 3 9

6 0 6 1 1 9 1

1 2 9 1 4 0 7

3 3 6 7 4 0 7

```
import java.io.*;
import java.util.Scanner;

public class petternrcognation
{
public static void main (String[]args) throws Exception
{
    Scanner keyboard = new Scanner(System.in);

    System.out.print("Enter the filename : ");
    String filename = keyboard.next();

    File myFile = new File (filename);

    Scanner dataFromTxt = new Scanner(myFile);

    int [] [] pattern = new int [6] [7];

    while (dataFromTxt.hasNext())
    {
        pattern[0][0] = dataFromTxt.nextInt();
        pattern[0][1] = dataFromTxt.nextInt();
        pattern[0][2] = dataFromTxt.nextInt();
        pattern[0][3] = dataFromTxt.nextInt();
        pattern[0][4] = dataFromTxt.nextInt();
        pattern[0][5] = dataFromTxt.nextInt();
        pattern[0][6] = dataFromTxt.nextInt();

        pattern[1][0] = dataFromTxt.nextInt();
        pattern[1][1] = dataFromTxt.nextInt();
        pattern[1][2] = dataFromTxt.nextInt();
        pattern[1][3] = dataFromTxt.nextInt();
        pattern[1][4] = dataFromTxt.nextInt();
        pattern[1][5] = dataFromTxt.nextInt();
        pattern[1][6] = dataFromTxt.nextInt();

        pattern[2][0] = dataFromTxt.nextInt();
        pattern[2][1] = dataFromTxt.nextInt();
        pattern[2][2] = dataFromTxt.nextInt();
        pattern[2][3] = dataFromTxt.nextInt();
        pattern[2][4] = dataFromTxt.nextInt();
        pattern[2][5] = dataFromTxt.nextInt();
        pattern[2][6] = dataFromTxt.nextInt();

        pattern[3][0] = dataFromTxt.nextInt();
        pattern[3][1] = dataFromTxt.nextInt();
        pattern[3][2] = dataFromTxt.nextInt();
        pattern[3][3] = dataFromTxt.nextInt();
        pattern[3][4] = dataFromTxt.nextInt();
        pattern[3][5] = dataFromTxt.nextInt();
        pattern[3][6] = dataFromTxt.nextInt();

        pattern[4][0] = dataFromTxt.nextInt();
        pattern[4][1] = dataFromTxt.nextInt();
        pattern[4][2] = dataFromTxt.nextInt();
        pattern[4][3] = dataFromTxt.nextInt();
        pattern[4][4] = dataFromTxt.nextInt();
        pattern[4][5] = dataFromTxt.nextInt();
        pattern[4][6] = dataFromTxt.nextInt();

        pattern[5][0] = dataFromTxt.nextInt();
        pattern[5][1] = dataFromTxt.nextInt();
        pattern[5][2] = dataFromTxt.nextInt();
        pattern[5][3] = dataFromTxt.nextInt();
        pattern[5][4] = dataFromTxt.nextInt();
        pattern[5][5] = dataFromTxt.nextInt();
        pattern[5][6] = dataFromTxt.nextInt();
    }

    for (int r = 0; r < pattern.length; r++)
    {
        for (int c = 0; c < pattern[r].length; c++)
        {
            System.out.print(pattern[r][c] + " ");
        }
        System.out.println(" ");
    }

    if (checkHorizontal(pattern) == true )
    {
        System.out.println("Horizontal Checked true");
    }
    else if (checkVertical(pattern) == true )
    {
        System.out.println("Vertical Checked true");
    }
}

public static boolean isConsecutiveFour(int[] values)
{
    for (int i = 0; i < values.length - 3; i++)
    {
        boolean isEqual = true;

        for (int j =i; j < i + 3; j++)
        {
            if (values[j] != values[j + 1])
            {
                isEqual = false;
                break;
            }
        }
        if (isEqual)
        {
            return true;
        }
    }
    return false;
}

public static boolean checkHorizontal(int[][] values)
{
    int numberOfRows = 6;
    int numberOfColumns = 7;

    for (int i = 0; i < numberOfRows; i++)
    {
        if (isConsecutiveFour(values[i]))
        {
            return true;
        }
    }
    return false;
}

public static boolean checkVertical(int [][] values)
{
    int numberOfRows = 6;
    int numberOfColumns = 7;

    for (int j =0; j < numberOfColumns; j++)
    {
        int [] column = new int[numberOfRows];

        if (isConsecutiveFour(column))
        {
            return true;
        }
    }
    return false;
}
}

```