code: private static void updateVolume(DataLine dataLine, int volume)
      {
          if (dataLine.isControlSupported(Type.MASTER_GAIN))
          {
              final FloatControl gainControl = (FloatControl) dataLine.getControl(Type.MASTER_GAIN);
              final double gain = UtilMath.clamp(volume / 100.0, 0.0, 100.0);
              final double dB = Math.log(gain) / Math.log(10.0) * 20.0;
              gainControl.setValue((float) dB);
          }
      }
docs: Update the sound volume.
  
  @param dataLine Audio source data.
  @param volume The audio playback volume value.