title: Elegant way to make sure string is no longer than a given length
body: <p>I want to know if there is a quicker and/or more elegant way to achieve this with Java 8.
  I would like to have a string no longer than a max length (say 4 character max)</p>
  
  <pre><code>input "" -&gt; ""
  input null -&gt; null
  input abc -&gt; abc
  input abcde -&gt; abcd
  
  some function (string s){
       if(s==null)
            return null;
       if(s.length()&gt;4)
            return s.substring(1,4);
       return s;
   }
  </code></pre>