Java BigInteger to bigIntToArray(BigInteger data)

Here you can find the source of bigIntToArray(BigInteger data)

Description

big Int To Array

License

Open Source License

Declaration

public static int[] bigIntToArray(BigInteger data) 

Method Source Code

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

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;

public class Main {
    public static int[] bigIntToArray(BigInteger data) {
        List<Integer> dataList = new ArrayList<Integer>();
        for (int i = 0; data.bitCount() > 0; i++, data = data.shiftRight(1)) {
            if (data.testBit(0))
                dataList.add(i);//w ww .j  ava2  s  . c  om
        }

        int[] dataArr = new int[dataList.size()];
        for (int i = 0; i < dataArr.length; i++)
            dataArr[i] = dataList.get(i);

        return dataArr;
    }
}

Related

  1. BigIntegerToEightBytes(BigInteger value)
  2. bigIntegerToHex(final BigInteger bigInteger)
  3. bigIntegerToList(BigInteger number)
  4. bigIntegerToString(final BigInteger value)
  5. bigIntegerToUnsignedByteArray(BigInteger a, int len)
  6. bigIntToHash(BigInteger keyValue)
  7. bigIntToHex(BigInteger big)
  8. bigIntToIpV6(BigInteger argInt)
  9. BigIntToPaddedByteArray(BigInteger bi, int length)