Extracted common code for number conveters to abstract super class (#11900)

Change-Id: I53e413f8e9c8754915d80c30d3dca97eb1881c74