Integral representations of affine transformations in phase space with an application to energy localization problems