code: protected static void adjustVolume (Line line, float vol)
      {
          FloatControl control = (FloatControl) line.getControl(FloatControl.Type.MASTER_GAIN);
  
          // the only problem is that gain is specified in decibals, which is a logarithmic scale.
          // Since we want max volume to leave the sample unchanged, our
          // maximum volume translates into a 0db gain.
          float gain;
          if (vol == 0f) {
              gain = control.getMinimum();
          } else {
              gain = (float) ((Math.log(vol) / Math.log(10.0)) * 20.0);
          }
  
          control.setValue(gain);
          //Log.info("Set gain: " + gain);
      }
docs: Use the gain control to implement volume.