MCPcopy Index your code
hub / github.com/qiyuangong/leetcode / bitLength

Method bitLength

java/751_IP_to_CIDR.java:25–33  ·  view source on GitHub ↗
(long x)

Source from the content-addressed store, hash-verified

23 x >> 24, (x >> 16) % 256, (x >> 8) % 256, x % 256);
24 }
25 private int bitLength(long x) {
26 if (x == 0) return 1;
27 int ans = 0;
28 while (x > 0) {
29 x >>= 1;
30 ans++;
31 }
32 return ans;
33 }
34}

Callers 1

ipToCIDRMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected