java program collecting data