Weighing of trapped ion crystals and its applications