public static String right(String str, int len) {
        if (str == null) {
            return null;
        }
        if (len < 0) {
            return "";
        }
        if (str.length() <= len) {
            return str;
        }
        return str.substring(str.length() - len);
    }
public static String right ( String str , int len ) { if ( str == null ) { return null ; } if ( len < 0 ) { return "" ; } if ( str . length ( ) <= len ) { return str ; } return str . substring ( str . length ( ) - len ) ; }
<p>Gets the rightmost <code>len</code> characters of a String.</p>
<p>If <code>len</code> characters are not available, or the String
is <code>null</code>, the String will be returned without an
an exception. An exception is thrown if len is negative.</p>
<pre>
StringUtils.right(null, *)    = null
StringUtils.right(*, -ve)     = ""
StringUtils.right("", *)      = ""
StringUtils.right("abc", 0)   = ""
StringUtils.right("abc", 2)   = "bc"
StringUtils.right("abc", 4)   = "abc"
</pre>

@param str the String to get the rightmost characters from, may be null
@param len the length of the required String, must be zero or positive
@return the rightmost characters, <code>null</code> if null String input