I am getting below error:
Be sure that the program works correctly if the sequence consists of numbers greater than 127.
Could you please help me this error , In the problem statement it was mentioned clearly we are adding only 10 numbers in a list
package com.codegym.task.task08.task0812;
import java.io.*;
import java.util.ArrayList;
import java.util.*;
import java.io.*;
/*
Longest sequence
*/
public class Solution {
public static void main(String[] args) throws IOException {
ArrayList<Integer> a = new ArrayList<Integer>(10);
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
int i=0;
int count =0;
int maxcount =0;
while(i<10){
int num = Integer.parseInt(r.readLine());
a.add(num);
if(i>1 && (a.get(i)== a.get(i-1))){
count++;
}
else{
count =1;
}
if(count>=maxcount){
maxcount = count;
}
i++;
}
System.out.println(maxcount);
//write your code here
}
}