Java BigInteger Calculate getKeyFromBigInteger(final BigInteger value, final int numBytes)

Here you can find the source of getKeyFromBigInteger(final BigInteger value, final int numBytes)

Description

get Key From Big Integer

License

Apache License

Declaration

protected static byte[] getKeyFromBigInteger(final BigInteger value, final int numBytes) 

Method Source Code

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

import java.math.BigInteger;

public class Main {
    protected static byte[] getKeyFromBigInteger(final BigInteger value, final int numBytes) {
        final byte[] valueBytes = value.toByteArray();
        final byte[] bytes = new byte[numBytes];
        System.arraycopy(valueBytes, 0, bytes, 0, Math.min(valueBytes.length, bytes.length));
        return bytes;
    }//  w  w  w .  j a  v a 2 s  . c  o  m
}

Related

  1. getInterfaceName(final BigInteger datapathid, final String portName, final Integer vlanId)
  2. getIpAddressByBigInteger(BigInteger[] bigs)
  3. getIpv4AddrFromNumber(BigInteger addr)
  4. getIpv6AddrFromNumber(BigInteger addr)
  5. getJsonFromBigIntArray(JsonGenerator jg, BigInteger[] array, String pf)
  6. getKnownDynamicmacFlowRef(short tableId, BigInteger dpId, long lporTag, String macAddress, long elanTag)
  7. getLongAsUnsignedBigInteger(long number)
  8. getMagnitude(BigInteger bi)
  9. getMetaDataForLPortDispatcher(int lportTag, short serviceIndex, BigInteger serviceMetaData)