Factorizations of integer matrices as products of idempotents and nilpotents