Check if all digits of the given integer are even.
Example
n = 248622, the output should be**solution(n) = true**;n = 642386, the output should be**solution(n) = false**.Input/Output
[execution time limit] 3 seconds (java)
[memory limit] 1 GB
[input] integer n
Guaranteed constraints:
1 ≤ n ≤ 109.
[output] boolean
true if all digits of n are even, false otherwise.
boolean solution(int n) {
String str = Integer.toString(n);
String [] arr = str.split("");
for (String s : arr) {
int i = Integer.parseInt(s);
if (i % 2 > 0) return false;
}
return true;
}