Java code for data generation of different types