Java Utililty Methods BigInteger Calculate

List of utility methods to do BigInteger Calculate

Description

The list of methods to do BigInteger Calculate are organized into topic(s).

Method

StringgetInterfaceName(final BigInteger datapathid, final String portName, final Integer vlanId)
get Interface Name
return String.format("%s:%s:%s", datapathid, portName, vlanId);
StringgetIpAddressByBigInteger(BigInteger[] bigs)
get Ip Address By Big Integer
if (bigs.length != 4 && bigs.length != 16) {
    throw new IllegalArgumentException();
byte[] bytes = new byte[bigs.length];
for (int i = 0; i < bigs.length; i++) {
    bytes[i] = (byte) (bigs[i].byteValue() & 0xff);
return getIpAddressByHexaBytes(bytes);
...
StringgetIpv4AddrFromNumber(BigInteger addr)
get Ipv Addr From Number
String[] field = new String[4];
BigInteger unit = BigInteger.valueOf(0x100L);
BigInteger number = addr;
for (int i = field.length - 1; i >= 0; i--) {
    BigInteger[] div = number.divideAndRemainder(unit);
    number = div[0];
    field[i] = div[1].toString(10);
StringBuilder builder = new StringBuilder(field[0]);
for (int i = 1; i < field.length; i++) {
    builder.append(".");
    builder.append(field[i]);
return builder.toString();
StringgetIpv6AddrFromNumber(BigInteger addr)
get Ipv Addr From Number
String[] field = new String[8];
BigInteger unit = BigInteger.valueOf(0x10000L);
BigInteger number = addr;
for (int i = field.length - 1; i >= 0; i--) {
    BigInteger[] div = number.divideAndRemainder(unit);
    number = div[0];
    field[i] = div[1].toString(16);
StringBuilder builder = new StringBuilder();
constructDecompressed(builder, field);
return builder.toString();
voidgetJsonFromBigIntArray(JsonGenerator jg, BigInteger[] array, String pf)
get Json From Big Int Array
jg.writeStartArray();
for (BigInteger obj : array) {
    jg.writeNumber(obj);
jg.writeEndArray();
byte[]getKeyFromBigInteger(final BigInteger value, final int numBytes)
get Key From Big Integer
final byte[] valueBytes = value.toByteArray();
final byte[] bytes = new byte[numBytes];
System.arraycopy(valueBytes, 0, bytes, 0, Math.min(valueBytes.length, bytes.length));
return bytes;
StringgetKnownDynamicmacFlowRef(short tableId, BigInteger dpId, long lporTag, String macAddress, long elanTag)
get Known Dynamicmac Flow Ref
return new StringBuffer().append(tableId).append(elanTag).append(dpId).append(lporTag).append(macAddress)
        .toString();
BigIntegergetLongAsUnsignedBigInteger(long number)
get Long As Unsigned Big Integer
if (number >= 0)
    return BigInteger.valueOf(number);
return BigInteger.valueOf(number).add(B64);
byte[]getMagnitude(BigInteger bi)
get Magnitude
byte[] b = bi.toByteArray();
if ((b.length > 1) && (b[0] == 0)) {
    int n = b.length - 1;
    byte[] newarray = new byte[n];
    System.arraycopy(b, 1, newarray, 0, n);
    b = newarray;
return b;
...
BigIntegergetMetaDataForLPortDispatcher(int lportTag, short serviceIndex, BigInteger serviceMetaData)
get Meta Data For L Port Dispatcher
return getServiceIndexMetaData(serviceIndex).or(getLportTagMetaData(lportTag)).or(serviceMetaData);