[Solved] How to check whether number is present in integer or not [closed]


int[] ints = new int[] { 76543, 65334, 776958, 8978, 2436, 232789 };
for (int i : ints) {
    boolean containsAllThree = false;
    if (String.valueOf(i).contains("7") && String.valueOf(i).contains("8") && String.valueOf(i).contains("9"))
        containsAllThree = true;
    System.out.println(containsAllThree);
}

since you need don’t need 789 but 7, 8 and 9 to be contained you have to perform 3 checks (i merged it into the IF condition)

solved How to check whether number is present in integer or not [closed]