Count all the "Good numbers" in a given range
You can first convert a number to a string, then split this string into an array, and then parse each digit back as an integer and check whether this integer divides the original number without a reminder. Example:
int[] goodNumbers = IntStream.rangeClosed(150, 200)
.filter(number -> {
// an array of digits as strings
String[] arr = String.valueOf(number).split("");
// check if good number
return Arrays.stream(arr)
// string with a digit as an integer
.mapToInt(Integer::parseInt)
// avoid division by '0'
.filter(i -> i != 0)
// if the remainder of dividing a number
// by all its constituent digits is '0',
// then it is a 'Good number'
.allMatch(i -> number % i == 0);
}).toArray();
System.out.println(Arrays.toString(goodNumbers));
// [150, 155, 162, 168, 175, 184, 200]
System.out.println("Count: " + goodNumbers.length);
// Count: 7