js substring from righy code example
Example 1: javascript get last n characters of string
'abc'.slice(-1); // c
Example 2: str.substring if 2 letters
public String firstTwo(String str) {
return str.length() < 2 ? str : str.substring(0, 2);
}