title: Compare first three characters of two strings
body: <p>Strings s1 and s2 will always be of length 1 or higher.</p>
  
  <p>How can I speed this up?</p>
  
  <pre><code>int l1 = s1.length();
  
  if (l1 &gt; 3) { l1 = 3; }
  
  if (s2.startsWith(s1.substring(0,l1))) 
  {
   // do something..
  }
  </code></pre>
  
  <p>Regex maybe? </p>