You could cast to `int` and replace the default value of `null`with `0`. If you cast everything to int the implementation will be more simple