title: endIndex is lesser than the length of this String object substring
body: <p>I have a String like below</p>
  
  <pre><code>String s = "John21071989Bangalore";
  
  Class Person {
    String name;
    Long dob;
    String city;
    ....
  }
  </code></pre>
  
  <p>I have a bean, split string and set the values to Bean.</p>
  
  <pre><code>Person p = new Person();
  p.setName(s.subString(0,4)); //John
  p.setDob(Long.ParseLong(s.subString(4,12))); //2071989
  p.setCity(s.subString(12,21));//Bangalore
  </code></pre>
  
  <p>Now my problem is if substring endIndesx is lesser than length giving error.I want to get dob value as null insted error.</p>
  
  <pre><code>String s1 = "John2107    Bangalore";
  
  Person p = new Person();
  p.setName(s.subString(0,4)); //John
  p.setDob(Long.ParseLong(s.subString(4,12))); //this should be null 
  p.setCity(s.subString(12,21));//Bangalore
  </code></pre>