added java solutions for p6 and p7