But David took not the number of them from twenty years old
Only those that were twenty years and upwards; but, according to Cornelius Bertram F11, he numbered them that were under twenty, though but sixteen, seventeen, eighteen, or nineteen years of age, provided they were of robust bodies, and of a tall stature, and able to bear arms; which he takes to be the sin of David, in numbering the people, being contrary to the law of God; yet though he had ordered them to be numbered, and they were, yet he would not take them and put them into the account of his chronicles, as in the next verse, that his sin might not be known, see ( 2 Samuel 24:9 )
because the Lord had said, he would increase Israel like to the stars
in the heavens;
which are not to be numbered, and therefore David sinned in attempting to number the people.
F11 Lucubrat. Franktall, c. 2.