public class DemoTest { public static void main (String [] args) { the System. OUT .println (isConvert ( " ABC " , " DDC " , 0 )); } / * * * There is a string A string B want to convert from a to B, a conversion only once, each time a character conversion should convert all of the a string into another character, * a can find the string into a string B. For example, "abc" - "bbc" --- "ddc" is satisfied is determined conversion * * / public static Boolean isConvert (A String, String B, int index) { // string into a character array char [] C11 =A.toCharArray (); char [] C21 = B.toCharArray (); // Get the character to replace the char m = C21 [index]; // Get the replaced character char F = C11 [index]; // iterate original character array for ( int I = 0 ; I <c11.length; I ++ ) { // if the same character and the need to replace the IF (C11 [I] == F) { C11 [I] = m; } } / / character array to a String A = arrayToString (C11); B =arrayToString (C21); // determine if it is a last IF ((index == A.length () - . 1 )) { IF (. A.trim () the equals (B.trim ())) { return to true ; } the else { return to false ; } } index ++ ; // recursive Analyzing return isConvert (A, B, index); } public static String arrayToString ( char [] C) { the StringBuilder SB = new new StringBuilder(); for (int i = 0; i < c.length; i++) { sb.append(c[i]); } return sb.toString(); } }