public void change ( ) { float newChange = ( random . nextFloat ( ) * 4 ) - 2 ; newChange = Math . round ( newChange * 100.0F ) / 100.0F ; if ( last . floatValue ( ) + newChange < 9 ) { newChange = - newChange ; } change = new BigDecimal ( newChange ) ; change = change . setScale ( 2 , BigDecimal . ROUND_UP ) ; last = last . add ( change ) ; if ( last . compareTo ( max ) > 0 ) { max = last ; } if ( last . compareTo ( min ) < 0 ) { min = last ; } time = new Date ( ) ; }
Alter the stock price