data collecting java code