author: Blankj blog : http://blankj.com time : 2017/05/08 desc :
| 9 | * </pre> |
| 10 | */ |
| 11 | public class Solution { |
| 12 | public int mySqrt(int x) { |
| 13 | long n = x; |
| 14 | while (n * n > x) { |
| 15 | n = (n + x / n) >> 1; |
| 16 | } |
| 17 | return (int) n; |
| 18 | } |
| 19 | |
| 20 | public static void main(String[] args) { |
| 21 | Solution solution = new Solution(); |
| 22 | System.out.println(solution.mySqrt(10)); |
| 23 | } |
| 24 | } |
nothing calls this directly
no outgoing calls
no test coverage detected