Be sure that the program works correctly if the sequence consists of numbers greater than 127.
getting this error
package com.codegym.task.task08.task0812;
import java.io.*;
import java.util.ArrayList;
/*
Longest sequence
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> numbers = new ArrayList<Integer>();
for (int i = 0; i < 10; i++) {
int n = Integer.parseInt(reader.readLine());
numbers.add(n);
}
int count = 1;
int max = 0;
for (int i = 1; i < numbers.size(); i++) {
if (numbers.get(i) == numbers.get(i - 1)) {
count++;
} else if (count>=max)
{
max = count;
count = 1;
}
}
if (count >= max) {
System.out.println(count);
}
else
System.out.println(max);
}
}