java utils,common handling method.