Java wave program for school