title: Extracting numbers into a string array
body: <p>I have a string which is of the form </p>
  
  <pre><code>String str = "124333 is the otp of candidate number 9912111242. 
           Please refer txn id 12323335465645 while referring blah blah.";
  </code></pre>
  
  <p>I need <code>124333</code>, <code>9912111242</code> and <code>12323335465645</code> in a string array. I have tried this with </p>
  
  <pre><code>while (Character.isDigit(sms.charAt(i))) 
  </code></pre>
  
  <p>I feel that running the above said method on every character is inefficient. Is there a way I can get a string array of all the numbers?  </p>