Implemented generation code with Java