It is a little bit complicated: int [] [] generate (int [] [] input) creates a new array with the same structure as input. The contents of each row are written on the next row.