I am trying to create a program that will tell if a number given to it is a \"Happy Number\" or not. Finding a happy number requires each digit in the number to be squared,
int num = 56;
String strNum = "" + num;
int strLength = strNum.length();
int sum = 0;
for (int i = 0; i < strLength; ++i) {
int digit = Integer.parseInt(strNum.charAt(i));
sum += (digit * digit);
}