Java code to generate data