here is my code for EASY problem—Life, the Universe, and Everything
import java.io.BufferedReader;
import java.io.InpputStreamReader;
import java.util.ArrayList;
class Life
{
ArrayList<Integer> numbers=new ArrayList<Integer>();
int number;
public void readInput(BufferedReader br) throws IOException
{
while((number=Integer.parseInt(br.readLine()))<99)
{
if(number<=42)
{
numbers.add(number);
}
}
result();
}
public void result()
{
for(int n:numbers)
{
System.out.println(n);
}
}
}
class TestLife
{
public static void main(String[] args) throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
Life l=new Life();
l.readInput(br);
}
}