Java tutorial
//package com.java2s; import android.text.TextUtils; public class Main { public static String interceptStringOfIndex(String str, int index) { String intercept = str; if (TextUtils.isEmpty(str)) { return str; } if (str.length() > index) { intercept = str.substring(str.length() - index, str.length()); } return intercept; } }