title: Array of strings to be put in to Vector
body: <p>I have this problem in the below code as it does not run but generated nullpointer exception. What i am trying to do here is get an input an array of strings then spit it but comma and then pass it to Integer type and then store it in a vector. Then get the maximum number from that array. Code shows no errors but hard to find whats wrong. </p>
  
  <pre><code>import java.util.Collections;
  import java.util.Vector;
  
  public class Splitting {
  
    /**
    * @param   
    */
  
  protected int[] temp;
  Vector&lt;Integer&gt; vec = new Vector&lt;Integer&gt;();
  
  public void split(String input) {
      if (input == null) {
        String[] str;
        str = input.split(",");
        temp = new int[str.length];
  
        for (int i = 0; i &lt; str.length; i++) {
              temp[i] = Integer.parseInt(str[i]);
              vec.add(temp[i]);
          }
      }
      System.out.println(vec);
      Collections.sort(vec);
  
      System.out.println(vec);
      Collections.max(vec);
  }
  
  
  
  public static void main(String[] args) {
      // TODO Auto-generated method stub
  
      Splitting obj = new Splitting();
  
      obj.split("12,65,21,23,89,67,12");
  
  
  
  }
  
  }
  </code></pre>