An efficient numerical method for solving the Boltzmann equation in multidimensions