The forth requirement can't be passed.
The error is "too many lines", but I checked the output on eclipse.
The output is the same as Example output.
I hope someone could give me a help. Appreciate it.
package com.codegym.task.task13.task1326;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.FileInputStream;
import java.lang.*;
import java.util.*;
import java.lang.Integer;
/*
Sorting even numbers from a file
*/
public class Solution {
public static void main(String[] args) throws Exception{
//write your code here
BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
FileInputStream rf=new FileInputStream(reader.readLine());
BufferedReader rff=new BufferedReader(new InputStreamReader(rf));
ArrayList<Integer> al=new ArrayList<Integer>();
while(true){
String y=rff.readLine();
if(y==null) {break;}
int x=Integer.parseInt(y);
System.out.println(x);
al.add(x);
}
rff.close();
Integer[] il=al.toArray(new Integer[al.size()]);
for(int i=1;i<il.length;i++){
int key=il[i];
int j=i-1;
while(j>=0&&key<il[j]){
il[j+1]=il[j];
j--;
}
il[j+1]=key;
}
ArrayList<Integer> res=new ArrayList<Integer>();
for(int w:il){
if(w%2==0){
res.add(w);
}
}
for(int yy:res){
System.out.println(yy);
}
}
}