Generating square sound waves with Java