List of utility methods to do BigInteger Calculate
BigInteger | getMetaDataMaskForLPortDispatcher(BigInteger metadataMaskForServiceIndex, BigInteger metadataMaskForLPortTag, BigInteger metadataMaskForService) get Meta Data Mask For L Port Dispatcher return metadataMaskForServiceIndex.or(metadataMaskForLPortTag).or(metadataMaskForService);
|
BigInteger | getN(BigInteger p, BigInteger q) get N return p.multiply(q);
|
int | getNafWeight(BigInteger k) get Naf Weight if (k.signum() == 0) { return 0; BigInteger _3k = k.shiftLeft(1).add(k); BigInteger diff = _3k.xor(k); return diff.bitCount(); |
long | getNatRouterIdFromMetadata(BigInteger metadata) get Nat Router Id From Metadata return (metadata.and(METADATA_MASK_VRFID)).longValue();
|
BigInteger | getNetAddress(BigInteger ip, BigInteger netmask) Gets the net address. return ip.and(netmask).and(BITMASK_IPV6);
|
BigInteger | getNextLexicographicalPermutation(BigInteger v) It computes lexicographically the next permutation of the bits in the given number. BigInteger t = v.or(v.subtract(BigInteger.ONE)).add(BigInteger.ONE);
return t.and(t.negate()).divide(v.and(v.negate())).shiftRight(1).subtract(BigInteger.ONE).or(t);
|
BigInteger | getNRightmostBits(final BigInteger in, final int n) Returns a BigInteger with the n rightmost bits of in .
final BigInteger mask = BigInteger.valueOf(2).pow(n).subtract(BigInteger.ONE); return in.and(mask); |
List | getNumbersBetweenRange(BigInteger minValue, BigInteger maxValue) This method generates all integer numbers between the given range List<BigInteger> numbers; if (maxValue.longValue() > Integer.MAX_VALUE) { numbers = new LinkedList<>(); } else { numbers = new ArrayList<>(); BigInteger auxiliarNumber = minValue; for (; auxiliarNumber.compareTo(maxValue) < 1; auxiliarNumber = auxiliarNumber.add(BigInteger.ONE)) { ... |
BigInteger | getPrivateKey(BigInteger ran, BigInteger publicKey) get Private Key return publicKey.modInverse(ran);
|
byte[] | getPrivateKeyBytes(BigInteger privateKey) get Private Key Bytes byte[] privateKeyPlainNumber = privateKey.toByteArray(); int plainNumbersOffs = privateKeyPlainNumber[0] == 0 ? 1 : 0; byte[] privateKeyBytes = new byte[32]; System.arraycopy(privateKeyPlainNumber, plainNumbersOffs, privateKeyBytes, privateKeyBytes.length - (privateKeyPlainNumber.length - plainNumbersOffs), privateKeyPlainNumber.length - plainNumbersOffs); return privateKeyBytes; |