public static double round ( double input , int decimals ) { final double p = Math . pow ( 10 , decimals ) ; return Math . round ( input * p ) / p ; }
Rounds a number to the amount of decimals specified