Java BigInteger Calculate getMagnitude(BigInteger bi)

Here you can find the source of getMagnitude(BigInteger bi)

Description

get Magnitude

License

Apache License

Declaration

public static byte[] getMagnitude(BigInteger bi) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.math.BigInteger;

public class Main {
    public static byte[] getMagnitude(BigInteger bi) {
        byte[] b = bi.toByteArray();
        if ((b.length > 1) && (b[0] == 0)) {
            int n = b.length - 1;
            byte[] newarray = new byte[n];
            System.arraycopy(b, 1, newarray, 0, n);
            b = newarray;//from ww w  . j ava 2s  . c o  m
        }
        return b;
    }
}

Related

  1. getIpv6AddrFromNumber(BigInteger addr)
  2. getJsonFromBigIntArray(JsonGenerator jg, BigInteger[] array, String pf)
  3. getKeyFromBigInteger(final BigInteger value, final int numBytes)
  4. getKnownDynamicmacFlowRef(short tableId, BigInteger dpId, long lporTag, String macAddress, long elanTag)
  5. getLongAsUnsignedBigInteger(long number)
  6. getMetaDataForLPortDispatcher(int lportTag, short serviceIndex, BigInteger serviceMetaData)
  7. getMetaDataMaskForLPortDispatcher(BigInteger metadataMaskForServiceIndex, BigInteger metadataMaskForLPortTag, BigInteger metadataMaskForService)
  8. getN(BigInteger p, BigInteger q)
  9. getNafWeight(BigInteger k)