Finished problem 28 in java