Java BigInteger to concat(BigInteger left, BigInteger right)

Here you can find the source of concat(BigInteger left, BigInteger right)

Description

concat

License

Open Source License

Declaration

private static BigInteger concat(BigInteger left, BigInteger right) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.math.BigInteger;

public class Main {
    private static BigInteger concat(BigInteger left, BigInteger right) {
        return concat(left, right, right.bitLength());
    }//from   ww  w . java  2s .c om

    private static BigInteger concat(BigInteger left, BigInteger right, int rightBitLength) {
        if (right.bitLength() > rightBitLength) {
            throw new IllegalArgumentException("right side has " + right.bitLength()
                    + " bits. Cannot be extended to " + rightBitLength + " bits");
        }
        return left.shiftLeft(rightBitLength).add(right);
    }
}

Related

  1. bigIntToIpV6(BigInteger argInt)
  2. BigIntToPaddedByteArray(BigInteger bi, int length)
  3. bigIntToSortableBytes(BigInteger bigInt, int bigIntSize, byte[] result, int offset)
  4. biToHex(BigInteger bi)
  5. byteConvert32Bytes(BigInteger n)
  6. convert(BigInteger value, int base, boolean extra)
  7. convertAllElementsToLong(P bigIntegers)
  8. convertBigIntegerIntoInetAddress(final BigInteger i)
  9. convertBigIntegerToNBytes( final BigInteger bigInteger, final int numBytes)