public class mylin {
/**
* @param args
*/
public static void main(String[] args) {
int n1 = 0;
int n2 = 0;
for (int i = 123; i <= 987; i++) {
n1 = i * 2;
n2 = i * 3;
if (isOK(i, n1,n2)) {
System.out.println("i:" + i + " n1:" + n1 + " n2:" + n2);
// break;
}
}
}
public static boolean isOK(int i,int n1,int n2){
String str = "123456789";
String s = i+""+n1+""+n2;
int index = 0;
String str1 = "";
for(int k =0;k<str.length();k++){
index = s.indexOf(str.charAt(k));
if(index>=0){
str1 = s.replaceFirst(str.charAt(k)+"", "a");
s = str1;
}
}
String s1 = s.replaceAll("a", "");
if(s1.length()==0){
return true;
}
return false;
}
}