public static double round(double number,int numberofdecimals){
int n=1;
for (int i = 1; i <= numberofdecimals;i++){
n=n*10;
}
double c =((number - Math.floor(number))*n);
c= Math.floor(c);
return (Math.floor(number) + (c/n));
}
My method is rounding some doubles perfectly but when I put ((5.0 / 3) ,2) in my number parameter it is giving me 1.6600000 what is going on?