public static float roundToDecimalPlaces(float numToRound,int decPlaces){
  float p=(float)Math.pow(10,decPlaces);
  numToRound=numToRound * p;
  float tmp=Math.round(numToRound);
  return (float)tmp / p;
}

public static float roundToDecimalPlaces ( float numToRound , int decPlaces ) { float p = ( float ) Math . pow ( 10 , decPlaces ) ; numToRound = numToRound * p ; float tmp = Math . round ( numToRound ) ; return ( float ) tmp / p ; }
returns a float representing a number rounded to a specific number of decimal places
