Spy number

A number is known as a spy number if the sum of its digits is exactly equal to the product of its digits.

Check Spy Number

import java.util.Scanner;

public class SpyNumber {
	private static boolean checkSpy(int number) {
		int sum = 0, mul = 1, rem;

		while (number > 0) {
			rem = number % 10;
			sum += rem;
			mul *= rem;
			number = number / 10;
		}
		if (sum == mul) {
			return true;
		} else {
			return false;
		}
	}

	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int number;

		System.out.print("Enter a number to check for spy number: ");
		number = reader.nextInt();
		reader.close();

		if (checkSpy(number)) {
			System.out.println(number + " is a spy number");
		} else {
			System.out.println(number + " is not a spy number");
		}
	}
}
Output
Enter a number to check for spy number: 123
123 is a spy number

Spy Number List (1-n)

import java.util.Scanner;

public class SpyNumberSeries {
	private static boolean checkSpy(int number) {
		int sum = 0, mul = 1, rem;

		while (number > 0) {
			rem = number % 10;
			sum += rem;
			mul *= rem;
			number = number / 10;
		}
		if (sum == mul) {
			return true;
		} else {
			return false;
		}
	}

	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int max;

		System.out.print("Enter the upper bound to find spy numbers: ");
		max = reader.nextInt();
		reader.close();


		System.out.println("Spy numbers:");
		for (int i = 1; i <= max; i++) {
			if (checkSpy(i)) {
				System.out.print(i + " ");
			}
		}
	}
}
Output
Enter the upper bound to find spy numbers: 2000
Spy numbers:
1 2 3 4 5 6 7 8 9 22 123 132 213 231 312 321 1124 1142 1214 1241 1412 1421