Here you can find the source of findCommonSuffixLength(CharSequence str1, CharSequence str2, int commonPrefixLength)
private static int findCommonSuffixLength(CharSequence str1, CharSequence str2, int commonPrefixLength)
//package com.java2s; public class Main { private static int findCommonSuffixLength(CharSequence str1, CharSequence str2, int commonPrefixLength) { int length = (Math.min(str1.length(), str2.length())); for (int i = 0; i < length - commonPrefixLength; i++) { if (str1.charAt(str1.length() - i - 1) != str2.charAt(str2 .length() - i - 1)) { return i; }/* w ww .ja va 2 s . co m*/ } return 0; } }