java File handling

Assume we have 2 files that are input.txt and output.txt
Input.txt has
Name||Age||email||contact No||Name1||age1||email1||contact No1||name2||Age2||email2||contact no2||etc…

initially the output.txt does not have any record.using a java program we have to make it as

Names in the input file:Name,Name1,Name2,Name3
Ages in the input file:Age,Age1,Age2,Age3
email id in the file: email, email1, email2
Contact no in the file:contact no, contact no1,contact no2

//