Game of ball moving like dancing written in java