public class Test004 { public static void main(String[] args) { for (int a = 111; a <= 333; a++) { if (hasZero(a)) { continue; } else { int b = 2 * a; int c = 3 * a; if (hasZero(b) || hasZero(c)) { continue; } String s = "" + a + b + c; if (isFind(s)) { System.out.print(a + " "); } } } } private static boolean hasZero(int n) { return String.valueOf(n).contains("0"); } private static boolean isFind(String x) { char[] arr = x.toCharArray(); Arrays.sort(arr); return "123456789".equals(String.valueOf(arr)); } }