question: protected String doubleToString ( double d , int prec ) { String result ; int currentPrec ; int i ; result = Utils . doubleToString ( d , prec ) ; if ( result . indexOf ( "." ) == - 1 ) { result += "." ; } currentPrec = result . length ( ) - result . indexOf ( "." ) - 1 ; for ( i = currentPrec ; i < prec ; i ++ ) { result += "0" ; } return result ; }
target:  returns the given number as string rounded to the given number of decimals. additional necessary 0's are added.