Buggy code:
public abstract class ClearVolumeRendererBase implements ClearVolumeCloseable , ClearVolumeRendererInterface { private int mNumberOfRenderLayers ; private volatile int mCurrentRenderLayerIndex = 0 ; private volatile int mBytesPerVoxel = 1 ; private RotationControllerInterface mRotationController ; private ProjectionAlgorithm mProjectionAlgorithm = ProjectionAlgorithm . MaxProjection ; private final TransferFunction [ ] mTransferFunctions ; private volatile boolean [ ] mLayerVisiblityFlagArray ; private volatile float mTranslationX = 0 ; private volatile float mTranslationY = 0 ; private volatile float mTranslationZ = 0 ; private volatile float mRotationX = 0 ; private volatile float mRotationY = 0 ; private volatile float mScaleX = 1.0F ; private volatile float mScaleY = 1.0F ; private volatile float mScaleZ = 1.0F ; private volatile float [ ] mBrightness ; private volatile float [ ] mTransferFunctionRangeMin ; private volatile float [ ] mTransferFunctionRangeMax ; private volatile float [ ] mGamma ; private volatile boolean mUpdateVolumeRenderingParameters = true ; private volatile long mVolumeSizeX ; private volatile long mVolumeSizeY ; private volatile long mVolumeSizeZ ; private volatile double mVoxelSizeX ; private volatile double mVoxelSizeY ; private volatile double mVoxelSizeZ ; private volatile boolean mVolumeDimensionsChanged ; private final Object [ ] mSetVolumeDataBufferLocks ; private volatile ByteBuffer [ ] mVolumeDataByteBuffers ; private final AtomicIntegerArray mDataBufferCopyIsFinished ; private ControlPanelJFrame mControlFrame ; protected Map < String , Processor < ? > > mProcessorsMap = new ConcurrentHashMap < > ( ) ; public ClearVolumeRendererBase ( final int pNumberOfRenderLayers ) { } public void setBytesPerVoxel ( final int pBytesPerVoxel ) { } @ Override public int getBytesPerVoxel ( ) { } public boolean getIsUpdateVolumeRenderingParameters ( ) { } @ Override public void notifyUpdateOfVolumeRenderingParameters ( ) { } public void clearIsUpdateVolumeParameters ( ) { } public void setVolumeSize ( final double pVolumeSizeX , final double pVolumeSizeY , final double pVolumeSizeZ ) { } public long getVolumeSizeX ( ) { } public long getVolumeSizeY ( ) { } public long getVolumeSizeZ ( ) { } public double getVoxelSizeX ( ) { } public double getVoxelSizeY ( ) { } public double getVoxelSizeZ ( ) { } public boolean haveVolumeDimensionsChanged ( ) { } public void clearVolumeDimensionsChanged ( ) { } public void setScaleX ( final double pScaleX ) { } public void setScaleY ( final double pScaleY ) { } public void setScaleZ ( final double pScaleZ ) { } @ Override public boolean isLayerVisible ( ) { } @ Override public boolean isLayerVisible ( final int pRenderLayerIndex ) { } @ Override public void setLayerVisible ( final boolean pVisble ) { } @ Override public void setLayerVisible ( final int pRenderLayerIndex , final boolean pVisble ) { } @ Override public void resetBrightnessAndGammaAndTransferFunctionRanges ( ) { } @ Override public void addBrightness ( final double pBrightnessDelta ) { } @ Override public void addBrightness ( final int pRenderLayerIndex , final double pBrightnessDelta ) { } @ Override public double getBrightness ( ) { } @ Override public double getBrightness ( final int pRenderLayerIndex ) { } @ Override public void setBrightness ( final double pBrightness ) { } @ Override public void setBrightness ( final int pRenderLayerIndex , final double pBrightness ) { <START_BUG> mBrightness [ getCurrentRenderLayerIndex ( ) ] = ( ( float ) ( ClearVolumeRendererBase . clamp ( pBrightness , 0 , ( ( getBytesPerVoxel ( ) ) == 1 ? 16 : 256 ) ) ) ) ; <END_BUG> notifyUpdateOfVolumeRenderingParameters ( ) ; } @ Override public double getGamma ( ) { } @ Override public double getGamma ( final int pRenderLayerIndex ) { } @ Override public void setGamma ( final double pGamma ) { } @ Override public void setGamma ( final int pRenderLayerIndex , final double pGamma ) { } @ Override public double getTransferRangeMin ( ) { } @ Override public double getTransferRangeMin ( final int pRenderLayerIndex ) { } @ Override public double getTransferRangeMax ( ) { } @ Override public double getTransferRangeMax ( final int pRenderLayerIndex ) { } @ Override public void setTransferFunctionRange ( final double pTransferRangeMin , final double pTransferRangeMax ) { } @ Override public void setTransferFunctionRange ( final int pRenderLayerIndex , final double pTransferRangeMin , final double pTransferRangeMax ) { } @ Override public void setTransferFunctionRangeMin ( final double pTransferRangeMin ) { } @ Override public void setTransferFunctionRangeMin ( final int pRenderLayerIndex , final double pTransferRangeMin ) { } @ Override public void setTransferFunctionRangeMax ( final double pTransferRangeMax ) { } @ Override public void setTransferFunctionRangeMax ( final int pRenderLayerIndex , final double pTransferRangeMax ) { } @ Override public void addTransferFunctionRangeMin ( final double pDelta ) { } @ Override public void addTransferFunctionRangeMin ( final int pRenderLayerIndex , final double pDelta ) { } @ Override public void addTransferFunctionRangeMax ( final double pDelta ) { } @ Override public void addTransferFunctionRangeMax ( final int pRenderLayerIndex , final double pDelta ) { } @ Override public void addTransferFunctionRangePosition ( final double pTransferRangePositionDelta ) { } @ Override public void addTransferFunctionRangeWidth ( final double pTransferRangeWidthDelta ) { } @ Override public void addTranslationX ( final double pDX ) { } @ Override public void addTranslationY ( final double pDY ) { } @ Override public void addTranslationZ ( final double pDZ ) { } @ Override public void addRotationX ( final int pDRX ) { } @ Override public void addRotationY ( final int pDRY ) { } public double getScaleX ( ) { } public double getScaleY ( ) { } public double getScaleZ ( ) { } @ Override public float getTranslationX ( ) { } @ Override public float getTranslationY ( ) { } @ Override public float getTranslationZ ( ) { } @ Override public float getRotationY ( ) { } @ Override public float getRotationX ( ) { } @ Override public void setTransferFunction ( final TransferFunction pTransfertFunction ) { } @ Override public void setTransferFunction ( final int pRenderLayerIndex , final TransferFunction pTransfertFunction ) { } @ Override public TransferFunction getTransferFunction ( final int pRenderLayerIndex ) { } @ Override public TransferFunction getTransferFunction ( ) { } public ProjectionAlgorithm getProjectionAlgorithm ( ) { }

Fix:
mBrightness [ pRenderLayerIndex ] = ( ( float ) ( ClearVolumeRendererBase . clamp ( pBrightness , 0 , ( ( getBytesPerVoxel ( ) ) == 1 ? 16 : 256 ) ) ) ) ;