printing the value
DecimalFormat df = new DecimalFormat ( " # . # # " ) ; df . setRoundingMode ( RoundingMode . HALF_UP ) ; System . out . println ( " Value at " + df . format ( value ) + " is " + df . format ( applyFormula ( value , x , y , n ) ) ) ; } }