Finished problem 11 in java