Now David was old and full of days; and he made Solomon his son king over Israel.
"Levites were numbered from thirty years old and upward"  (1 Chronicles 23:3).  David's actions here in numbering the Levites conformed exactly to the instructions of Moses given in  Numbers 4:23.