public String rightStr(String str,int length){
  return str.substring(Math.max(0,str.length() - length));
}

public String rightStr ( String str , int length ) { return str . substring ( Math . max ( 0 , str . length ( ) - length ) ) ; }
returns a substring of the given string , representing the ' length ' most - right characters
