Java BigInteger to toByteArray(BigInteger i)

Here you can find the source of toByteArray(BigInteger i)

Description

to Byte Array

License

Open Source License

Declaration

public static byte[] toByteArray(BigInteger i) 

Method Source Code

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

import java.math.BigInteger;
import java.util.Arrays;

public class Main {
    public static byte[] toByteArray(BigInteger i) {
        byte[] array = i.toByteArray();
        if (array[0] == 0) {
            array = Arrays.copyOfRange(array, 1, array.length);
        }/* w ww  .  j ava2 s .c o m*/
        return array;
    }
}

Related

  1. convertValueToZeroIfNullOrNegative(BigInteger value)
  2. getUnsignedBigIntegerAsHex(BigInteger bi)
  3. getUnsignedBytes(BigInteger number, int length)
  4. stringForBig(BigInteger big, int sigchars)
  5. toBase_128(BigInteger val)
  6. toByteArray(final BigInteger b)
  7. toByteArray(final BigInteger value, final int numBytes)
  8. toByteArrayUnsigned(BigInteger bi)
  9. toBytes(BigInteger bigInt, int expectedSize)