private String getCommonPrefix(String str1, String str2) {
            int len = str1.length() < str2.length() ? str1.length() : str2
                    .length();
            int index = -1;
            for (int i = 0; i < len; i++) {
                if (str1.charAt(i) == str2.charAt(i)) {
                    index = i;
                } else {
                    break;
                }
            }

            return str1.substring(0, index + 1);
        }