HappyNumbers, Ruby&Java solutions