public class MyClass {
private static boolean check_digit_exists(int n, int digit) {
while (n > 0) {
if (digit == n % 10) {
return true;
}
n = n / 10;
}
return false;
}
public static void main(String args[]) {
int num = 230138;
System.out.println(check_digit_exists(num, 2));
System.out.print(check_digit_exists(num, 5));
}
}
/*
run:
true
false
*/