//OPTION #1 int d = 1; double temp = n; while math.round(temp > 0.0009) { temp = temp / 10; d++; }