Finding 3 equal consecutive numbers in two different Arrays. Java
<p>I am writing a program that reads a CSV file and stores each column into a separate array. later I want to search arrays A and B and make for 3 consecutive 0s and then 2 ones following them. An example of the console after I run the program is; </p>

<pre><code>                                            A   B
Line # 1    1.3167  1.3164  1.318   1.3174  0   0
Line # 2    1.3167  1.3164  1.318   1.3174  0   0
Line # 3    1.3175  1.3164  1.3182  1.3169  0   0
Line # 4    1.3168  1.3167  1.3225  1.3212  1   1
Line # 5    1.3213  1.3206  1.3221  1.321   1   0
Line # 6    1.3211  1.3208  1.3241  1.3239  1   1
Line # 7    1.324   1.3237  1.3262  1.3242  1   1
Line # 8    1.3243  1.3234  1.3271  1.3245  0   1
Line # 9    1.3244  1.3223  1.3251  1.324   0   0
Line # 10   1.3241  1.3226  1.3269  1.3269  1   1
</code></pre>

<p>There are many more lines, however I want the program to find and a message to me every time the pattern from line 1-4 occur. </p>

<p>My code is</p>

<pre><code>package pacakge;
import java.io.*;
import java.util.Scanner;

public class read {
  public static void main(String[] args) throws FileNotFoundException  {
    int size=0;
    double[] open = new double[1000000];
    double[] low = new double[1000000];
    double[] high = new double[1000000];
    double[] close = new double[1000000];
    int[] A = new int[1000000];
    int[] B = new int[1000000];

    int zeroCount = 0;

    Scanner read = new Scanner(new File("C:/Users/Eric/Documents/Data Structures/EURUSD.csv"));
    read.nextLine();
    while(read.hasNextLine()) {
      String[] n= read.nextLine().split(",");
      open[size]=Double.parseDouble(n[0]);
      low[size]=Double.parseDouble(n[1]);
      high[size]=Double.parseDouble(n[2]);
      close[size]=Double.parseDouble(n[3]);
      A[size]=Integer.parseInt(n[4]);
      B[size]=Integer.parseInt(n[5]);
      size++;
    }

    for (int i = 0; i &lt; size; i++){
      System.out.println(open[i] + "\t" + low[i] + "\t" + high[i] + "\t" + close[i] + "\t" + A[i] + "\t" + B[i]);
      System.out.println("Line" + i);
      System.out.println(open[68722]);

      if(A[i]==0 &amp;&amp; A[i+1] == 0 &amp;&amp; A[i+2] == 0 &amp;&amp; B[i]==0 &amp;&amp; B[i+1] == 0 &amp;&amp; B[i+2] == 0) {
        zeroCount++;
        System.out.println("Found Pattern !!!" + zeroCount);
        break;
      }
    }
  }
}
</code></pre>

<p>After I run it runs fine, but it finds three 0s however, the order isn't consecutive. I'm not sure why this is not working. Thank you.</p>
