please comment me a solution!!
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 {
ArrayList<Integer> list = new ArrayList<Integer>();
ArrayList<Integer> list1 = new ArrayList<Integer>();
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
for(int i=0;i<10;i++){
list.add(Integer.parseInt(reader.readLine()));
}
int max=1;
int search = list.get(0);
for(int i=1;i<list.size();i++){
if(search == list.get(i)){
max++;
}
else{
list1.add(max);
max = 1;
search = list.get(i);
}
}
int longest = list1.get(0);
for(int i=1;i<list1.size();i++){
if(longest < list1.get(i)){
longest = list1.get(i);
}
}
System.out.println(longest);
}
}