Here you can find the source of getIpAddressByBigInteger(BigInteger[] bigs)
public static String getIpAddressByBigInteger(BigInteger[] bigs)
//package com.java2s; //License from project: Apache License import java.math.BigInteger; import java.util.ArrayList; import java.util.List; public class Main { public static String getIpAddressByBigInteger(BigInteger[] bigs) { if (bigs.length != 4 && bigs.length != 16) { throw new IllegalArgumentException(); }/* w w w .ja va 2 s . c o m*/ byte[] bytes = new byte[bigs.length]; for (int i = 0; i < bigs.length; i++) { bytes[i] = (byte) (bigs[i].byteValue() & 0xff); } return getIpAddressByHexaBytes(bytes); } public static String getIpAddressByHexaBytes(byte[] bytes) { StringBuffer sb = null; if (bytes.length == 4) { for (byte b : bytes) { if (sb == null) { sb = new StringBuffer().append((int) b); } else { sb.append(".").append((int) b); } } } else if (bytes.length == 16) { List<String> hexa = parseBytesAsHexString(bytes); for (String h : hexa) { if (sb == null) { sb = new StringBuffer().append(h); } else { sb.append(":").append(h); } } } return (sb == null ? "" : sb.toString()); } private static List<String> parseBytesAsHexString(byte[] bytes) { List<String> result = new ArrayList<String>(); for (byte b : bytes) { result.add(Integer.toHexString(b & 0xff)); } return result; } }