substring in java get last two characters code example
Example 1: str.substring last 2 java
String substring = str.length() > 2 ? str.substring(str.length() - 2) : str;
Example 2: Java repeat last 3 letters of string
word + word.substring(word.length()-3, word.length())