Java BigInteger to bigIntegerToBitArray(BigInteger x, int length)

Here you can find the source of bigIntegerToBitArray(BigInteger x, int length)

Description

big Integer To Bit Array

License

Open Source License

Declaration

public static int[] bigIntegerToBitArray(BigInteger x, int length) throws Exception 

Method Source Code


//package com.java2s;
import java.math.*;

public class Main {
    public static int[] bigIntegerToBitArray(BigInteger x, int length) throws Exception {
        int[] result = new int[length];

        for (int i = 0; i < result.length; i++) {
            result[i] = x.testBit(i) ? 1 : 0;
        }/*w  w w. ja  va  2  s .  com*/

        return result;
    }
}

Related

  1. bigIntegerToAddress(BigInteger ethereumAddress)
  2. bigIntegerToBase64(BigInteger value)
  3. BigIntegerToByteArrayWithoutSign(BigInteger value)
  4. bigIntegerToBytes(BigInteger b, int numBytes)
  5. bigIntegerToBytes(BigInteger b, int numBytes)
  6. bigIntegerToBytes(BigInteger b, int numBytes)