question: public final double doOperation ( ) throws OperatorFailedException { final int dim = bitsParameter . getDimension ( ) ; List < Integer > ones = new ArrayList < Integer > ( ) ; List < Integer > zeros = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < dim ; i ++ ) { if ( bitsParameter . getParameterValue ( i ) == 1.0 ) { ones . add ( i ) ; } else { zeros . add ( i ) ; } } if ( ones . size ( ) >= numBitsToMove && zeros . size ( ) >= numBitsToMove ) { for ( int i = 0 ; i < numBitsToMove ; i ++ ) { int myOne = ones . remove ( MathUtils . nextInt ( ones . size ( ) ) ) ; int myZero = zeros . remove ( MathUtils . nextInt ( zeros . size ( ) ) ) ; bitsParameter . setParameterValue ( myOne , 0.0 ) ; bitsParameter . setParameterValue ( myZero , 1.0 ) ; if ( valuesParameter != null ) { double value1 = valuesParameter . getParameterValue ( myOne ) ; double value2 = valuesParameter . getParameterValue ( myZero ) ; valuesParameter . setParameterValue ( myOne , value2 ) ; valuesParameter . setParameterValue ( myZero , value1 ) ; } } } else throw new OperatorFailedException ( "Not enough bits to move!" ) ; return 0.0 ; }
target:  Pick a random k ones in the vector and move them to a random k zero positions.