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

Method longToIP

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

Source from the content-addressed store, hash-verified

19 return ans;
20 }
21 private String longToIP(long x) {
22 return String.format("%s.%s.%s.%s",
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;

Callers 1

ipToCIDRMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected