title: Why i am getting a Number FormatException?
body: <p>I made a program on the code chef.I am getting a correct output on my eclipse ide and when i  submitted it the output shown on CodeChef ide is :</p>
  
  <pre><code>Exception in thread "main" java.lang.NumberFormatException: null
  at java.lang.Integer.parseInt(Integer.java:542)
  at java.lang.Integer.parseInt(Integer.java:615)
  at Prog1.stop(Main.java:16)
  at Prog1.main(Main.java:50)
  </code></pre>
  
  <p>Here is the question Link:<a href="https://www.codechef.com/problems/TEST" rel="nofollow">https://www.codechef.com/problems/TEST</a></p>
  
  <p>Here is my solution to the problem:
  //life universe and EveryThing</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  
  class Prog1 
  {
   public static void stop() throws IOException
   {
  
     BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
     String s1=br.readLine();
     int x=Integer.parseInt(s1);
     int ar[]=new int[x];
     int k=0;
      for(int i=0;i&lt;x;i++)
       {
         BufferedReader br1=new BufferedReader(new InputStreamReader(System.in));
         String s2=br1.readLine();
         int p=Integer.parseInt(s2);
         ar[k++]=p;
       }
     for(int m=0;m&lt;x;m++)
      {
         System.out.println(ar[m]);
      }
     for(int y=0;y&lt;x;)
      {
          if(ar[y]!=42)
          {
            System.out.println(ar[y]);
            y++;
          }
          else
          {
            break;
          }
  
      }
  
  }
   public static void main(String s[]) throws IOException
   {
   stop();
   }
  }
  </code></pre>