Get Mystery Box with random crypto!

#N1880. Check if Word Equals Summation of Two Words problem li | Leetcode in Java && MySQL

#N1880. Check if Word Equals Summation of Two Words
problem link

#solution
class Solution {
public boolean isSumEqual(String firstWord, String secondWord, String targetWord) {
int num1, num2, target;
num1 = func(firstWord);
num2 = func(secondWord);
target = func(targetWord);

return num1 + num2 == target;
}

public int func(String str){
int x=0;

for(char ch: str.toCharArray())
x = x*10 + (int)(ch-'a');

return x;
}
}