Here you can find the source of bigIntToIpV6(BigInteger argInt)
public static String bigIntToIpV6(BigInteger argInt)
//package com.java2s; /*/*from w w w .j a v a2s .co m*/ Copyright (C) 2011 NTT DATA Corporation This program is free software; you can redistribute it and/or Modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ import java.math.BigInteger; public class Main { public static String bigIntToIpV6(BigInteger argInt) { StringBuilder str = new StringBuilder(); for (int i = 15; i >= 0; i--) { int shift = 8 * i; Integer n = 0xff; BigInteger num = argInt.shiftRight(shift).and(new BigInteger(n.toString())); int intNum = num.intValue(); String s = Integer.toHexString(intNum); if (s.length() < 2) { s = "0" + s; } str.append(s); if (i > 0 && i < 15) { int f = i % 2; str.append(f == 0 ? ":" : ""); } } return str.toString(); } }