/** * 求一个数的立方根,利用二分法,时间复杂度在logn **/ private static double getCubeRoot(double input){ double min = 0; double max = input; double mid = 0; while ((max - min) > 0.0001){ mid = (max + min) / 2; if(mid * mid * mid > input){ max = mid; continue; } if(mid * mid * mid < input){ min = mid; continue; } return mid; } return max; }