MCPcopy Create free account
hub / github.com/DiUS/java-faker / ipV6Address

Method ipV6Address

src/main/java/com/github/javafaker/Internet.java:243–255  ·  view source on GitHub ↗

Returns an IPv6 address in hh:hh:hh:hh:hh:hh:hh:hh format. @return a correctly formatted IPv6 address.

()

Source from the content-addressed store, hash-verified

241 * @return a correctly formatted IPv6 address.
242 */
243 public String ipV6Address() {
244 final StringBuilder tmp = new StringBuilder();
245 for (int i=0;i < 8;i++) {
246 if (i > 0) {
247 tmp.append(":");
248 }
249 tmp.append(Integer.toHexString(faker.random().nextInt(16)));
250 tmp.append(Integer.toHexString(faker.random().nextInt(16)));
251 tmp.append(Integer.toHexString(faker.random().nextInt(16)));
252 tmp.append(Integer.toHexString(faker.random().nextInt(16)));
253 }
254 return tmp.toString();
255 }
256
257 /**
258 * @return a valid IPV6 CIDR

Callers 2

ipV6CidrMethod · 0.95
testIpV6Method · 0.80

Calls 3

nextIntMethod · 0.80
toStringMethod · 0.80
randomMethod · 0.45

Tested by 1

testIpV6Method · 0.64